通知短信+运营短信,5秒速达,支持群发助手一键发送🚀高效触达和通知客户 广告
[TOC] ## 示例 ### 输出 ``` #include <phpcpp.h> #include <iostream> void myFunction() { // endl 自带换行 Php::out << "example output1" << std::endl; Php::out << "example output2\n" << std::flush; Php::out << "example "; Php::out << "output3\n"; Php::out.flush(); // 自己测试失效 Php::echo("Example output\n"); } extern "C" { PHPCPP_EXPORT void *get_module() { static Php::Extension extension("my_extension", "1.0"); extension.add<myFunction>("myFunction"); return extension; } } ``` ``` <?php myFunction(); ``` ### 错误 ``` #include <phpcpp.h> #include <iostream> void myFunction() { Php::notice << "this is a notice \n" << std::flush; Php::warning << "this is a warning\n" << std::flush; // 通知用户调用了一个已弃用的函数 Php::deprecated << "this method is deprecated\n" << std::flush; // 抛出错误 Php::error << "fatal error\n" << std::flush; } ... ``` ``` set_error_handler("error_handler"); function error_handler($errno, $errstring, $errfile, $line, $trace) { echo $errstring; return ; } myFunction(); ```