-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请问如何在PHPX_FUNCTION写的函数里返回值呢? #30
Comments
通过形参retval返回 |
补充说明: 使用retval赋值可以给函数返回返回值。但是发现bug: 下面是代码: #include "phpx.h"
#include <iostream>
using namespace php;
using namespace std;
PHPX_FUNCTION(func_test)
{
retval = 1234;
}
PHPX_EXTENSION()
{
Extension *extension = new Extension("my_ext", "0.0.1");
extension->onStart = [extension]() noexcept
{
};
extension->registerFunction(PHPX_FN(func_test));
extension->info(
{
"my_ext support", "enabled"
},
{
{ "author", "Yjc" },
{ "version", extension->version },
{ "date", "2017-08-29" },
});
return extension;
} echo.php <?php
var_dump(func_test()); 输出:
|
@matyhtf 麻烦您看看这个兼容性问题。 |
检查的代码是不是最新的,最近的一次提交,刚刚修复了 retval 的问题 |
问题已解决。作者已经更新了一版,需要升级到最新版本,删除旧的so文件后重新编译PHP-X和扩展。感谢作者的回复!祝PHP-X越来越好! |
close |
No description provided.
The text was updated successfully, but these errors were encountered: