ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 示例 ### 读取php.ini变量 ``` void myFunction() { int output_buffering = Php::ini_get("output_buffering"); std::string variables_order = Php::ini_get("variables_order"); } ``` ### 从php.ini中检索预定义的变量 则必须先在get_module()函数中注册它们,然后才能调用Php :: ini_get()检索当前值 ``` #include <phpcpp.h> void myFunction() { int var1 = Php::ini_get("my_extension.var1"); std::string var2 = Php::ini_get("my_extension.var2"); } extern "C" { PHPCPP_EXPORT void *get_module() { static Php::Extension extension("my_extension", "1.0"); // export one function extension.add("myFunction", myFunction); // 注册 配置 extension.add(Php::Ini("my_extension.var1", "default-value")); extension.add(Php::Ini("my_extension.var2", 12345)); // return a pointer to the extension object return extension; } } ```