1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        PHP-CPPPHP 開發(fā)擴(kuò)展 C++ 庫

        聯(lián)合創(chuàng)作 · 2023-10-01 09:42

        PHP-CPP是一個(gè)用于開發(fā)PHP擴(kuò)展的C++庫。它提供了一套詳實(shí)易用的類,用于開發(fā)PHP擴(kuò)展。詳細(xì)文檔說明:http://www.php-cpp.com

        示例1:

        Php::Value hello_world(){
            return "hello world!";}

        示例2:

        #include <phpcpp.h>
        
        /**
         *  Global variable that stores the number of times 
         *  the function updateCounters() has been called in total
         *  @var    int
         */
        int invokeTotalCount = 0;
        
        /**
         *  Global variable that keeps track how many times the
         *  function updateCounters() was called during the
         *  current request
         *  @var    int
         */
        int invokeDuringRequestCount = 0;
        
        /**
         *  Native function that is callable from PHP
         *
         *  This function updates a number of global variables that count
         *  the number of times a function was called
         */
        void updateCounters()
        {
            // increment global counters
            invokeTotalCount++;
            invokeDuringRequestCount++;
        }
        
        /**
         *  Switch to C context, because the Zend engine expects get get_module()
         *  to have a C style function signature
         */
        extern "C" {
            /**
             *  Startup function that is automatically called by the Zend engine
             *  when PHP starts, and that should return the extension details
             *  @return void*
             */
            PHPCPP_EXPORT void *get_module() 
            {
                // the extension object
                static Php::Extension extension("my_extension", "1.0");
                
                // install a callback that is called at the beginning 
                // of each request
                extension.onRequest([]() {
                    
                    // re-initialize the counter
                    invokeDuringRequestCount = 0;
                });
                
                // add the updateCounter method to the extension
                extension.add("updateCounters", updateCounters);
                
                // return the extension details
                return extension;
            }
        }



        瀏覽 19
        點(diǎn)贊
        評論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)
        評論
        圖片
        表情
        推薦
        點(diǎn)贊
        評論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            免费看一级一级人妻片 | 99re这里只有精品在线观看 | 女人与拘做爰视频免费观看 | 男人操女人30分钟 | 特黄色视频 | 草逼小视频 | 波多野结衣被侵犯 | 李美淑伦理91 | 97国产精品A片 | 99国产精品99久久久久久娜娜 |