<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] ## 示例 ``` #include <phpcpp.h> #include <iostream> void example_function(Php::Parameters &params) { Php::Value array = params[0]; // 調用 php的 array_keys std::vector<std::string> keys = Php::array_keys(array); for (auto &key : keys) { Php::out << "key: " << key << std::endl; } // call a function from user space Php::Value data = Php::call("some_function", "some_parameter"); Php::out<<"輸出 some_function 的參數"<<data << std::flush; // 相當于 $time = new DateTime('now') Php::Object time("DateTime", "now"); // 調用 time.format Php::out << time.call("format", "Y-m-d H:i:s") << std::endl; // 獲得回調函數 Php::Value callback = params[1]; // 調用函數 callback("some","parameter"); // in PHP it is possible to create an array with two parameters, the first // parameter being an object, and the second parameter should be the name // of the method, we can do that in PHP-CPP too Php::Array time_format({time, "format"}); // call the method that is stored in the array Php::out << time_format("Y-m-d") << std::endl; } extern "C" { PHPCPP_EXPORT void *get_module() { static Php::Extension extension("my_extension", "1.0"); extension.add("example_function", example_function); return extension; } } ``` index.php ``` // define a user space function function some_function($param) { echo("some_function 的參數 $param\n"); } // example input $input = array( 'x' => 10, 'y' => 20, 'z' => 30 ); example_function($input, function($param1, $param2) { echo("匿名函數的參數 $param1 $param2\n"); }); //key: x // key: y // key: z // some_function 的參數 some_parameter // 輸出 some_function 的參數2020-09-02 18:26:52 // 匿名函數的參數 some parameter // 2020-09-02 ``` > 如果調用不存在的函數或方法,將拋出Php :: Exception。如果您沒有在C ++代碼中捕獲此異常,則它將冒泡并出現在PHP用戶空間中。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看