<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                [TOC] ## 示例 ### 全局常量 ``` #include <phpcpp.h> extern "C" { PHPCPP_EXPORT void *get_module() { static Php::Extension myExtension("my_extension", "1.0"); // floating point constants myExtension.add(Php::Constant("MY_CONSTANT_3", 3.1415927)); // string constants myExtension.add(Php::Constant("MY_CONSTANT_5", "This is a constant value")); // null constants myExtension.add(Php::Constant("MY_CONSTANT_7", nullptr)); // return the extension return myExtension; } } ``` ``` <?php echo(MY_CONSTANT_3."\n"); echo(MY_CONSTANT_5."\n"); echo(MY_CONSTANT_7."\n"); ``` ### 類級別常量 ``` #include <phpcpp.h> class Dummy : public Php::Base { }; extern "C" { PHPCPP_EXPORT void *get_module() { static Php::Extension myExtension("my_extension", "1.0"); Php::Class<Dummy> dummy("Dummy"); // 有三方方式給類賦值常量, dummy.property("MY_CONSTANT_1", 1, Php::Const); dummy.property("MY_CONSTANT_2", "abcd", Php::Const); dummy.constant("MY_CONSTANT_3", "xyz"); dummy.constant("MY_CONSTANT_4", 3.1415); dummy.add(Php::Constant("MY_CONSTANT_5", "constant string")); dummy.add(Php::Constant("MY_CONSTANT_5", true)); // add the class to the extension myExtension.add(std::move(dummy)); // return the extension return myExtension; } } ``` ### 運行時常量 在運行時從C ++代碼中查找用戶空間常量的值,或者要查找是否定義了常量,則可以簡單地使用Php :: constant()或Php :: define() <details> <summary>main.cpp</summary> ``` #include <phpcpp.h> void example_function() { //檢查是否定義了某個用戶空間常數 if (Php::defined("USER_SPACE_CONSTANT")) { //查找一個常量的值 Php::Value constant = Php::constant("ANOTHER_CONSTANT"); //在運行時定義其他常量 Php::define("DYNAMIC_CONSTANT", 12345); } } extern "C" { PHPCPP_EXPORT void *get_module() { static Php::Extension myExtension("my_extension", "1.0"); myExtension.add("example_function", example_function); return myExtension; } } ``` </details> <br /> <details> <summary>main.php</summary> ``` <?php define('USER_SPACE_CONSTANT',1); example_function(); echo DYNAMIC_CONSTANT; //12345 ``` </details> <br />
                  <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>

                              哎呀哎呀视频在线观看