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

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                [TOC] ## 示例 ### 普通成員變量 <details> <summary>main.cpp</summary> ``` #include <phpcpp.h> class Example : public Php::Base { public: Example() = default; virtual ~Example() = default; void __construct() { Php::Value self(this); } }; extern "C" { PHPCPP_EXPORT void *get_module() { static Php::Extension myExtension("my_extension", "1.0"); Php::Class<Example> example("Example"); example.method<&Example::__construct>("__construct"); // 設置元素值 example.property("property1", "xyz", Php::Public); myExtension.add(std::move(example)); return myExtension; } } ``` </details> <br /> <details> <summary>main.php</summary> ``` <?php $e = new Example(); // 已有元素值 var_dump($e->property1); $e->property1 = "new value1"; var_dump($e->property1); // new value1 ``` </details> <br /> ### 靜態屬性和類常量 <details> <summary>main.cpp</summary> ``` #include <phpcpp.h> class Example : public Php::Base { public: Example()=default; virtual ~Example()=default; }; extern "C" { PHPCPP_EXPORT void *get_module() { static Php::Extension myExtension("my_extension", "1.0"); Php::Class<Example> example("Example"); // the Example class has a class constant example.property("MY_CONSTANT", "some value", Php::Const); // and a public static propertie example.property("my_property", "initial value", Php::Const | Php::Static); // add the class to the extension myExtension.add(std::move(example)); // return the extension return myExtension; } } ``` </details> <br /> <details> <summary>main.php</summary> ``` <?php var_dump(Example::MY_CONSTANT); // 無法實現 ,出現錯誤 var_dump(Example::$my_property); ``` </details> <br /> ### 智能屬性 <details> <summary>main.cpp</summary> ``` #include <phpcpp.h> class Example : public Php::Base { private: int _value = 0; public: Example() = default; virtual ~Example() = default; Php::Value getValue() const { return _value; } void setValue(const Php::Value &value) { _value = value; if (_value > 100) _value = 100; } }; extern "C" { PHPCPP_EXPORT void *get_module() { static Php::Extension myExtension("my_extension", "1.0"); Php::Class<Example> example("Example"); // 對屬性進行 讀取與設置 example.property("value", &Example::getValue, &Example::setValue); myExtension.add(std::move(example)); return myExtension; } } ``` </details> <br /> <details> <summary>main.php</summary> ``` <?php $object = new Example(); $object->value="23"; var_dump($object->value); // 23 ``` </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>

                              哎呀哎呀视频在线观看