如何使用 PHP-CPP 在 PHP 类中添加静态数组
how to add an static array in php class with php-cpp
我想添加一个静态成员,如下所示
class BaseYii{
public static $map = [1,2,3]//sutff
}
这是我的C++代码,
class BaseYii : public Php::Base {
public:
Php::Array hehe;
BaseYii() = default;
/**
* c++ destructor
*/
virtual ~BaseYii() = default;
void __construct() {
Php::Value self(this);
Php::Array x{123, "adf"};
self["fff"] = x;
}
void getServer() {
Php::call("var_dump", Php::SERVER);
}
};
寄存器扩展, 如何将 Php::Array 或 Php::value 设置为此属性
Php::Class<BaseYii> baseYii("BaseYii");
Php::Class<Yii> Yii("Yii");
static std::map<int, int> map;
map[1] = 1;
baseYii.property("classMap", "here ,i want to set a Array or Php::value", Php::Public | Php::Static);
Zend API 不支持此功能 — 默认属性值不能是数组、对象或资源。
http://lxr.php.net/source/xref/PHP-7.0/Zend/zend_API.c
https://github.com/CopernicaMarketingSoftware/PHP-CPP/issues/277
相关文章:
- 添加静态constexpr成员是否会更改结构/类的内存映射
- 如何在友元函数中使用静态成员而不添加前缀 [类名]::
- 如何将 libjpeg-turbo Android NDK 添加为静态库
- 将在堆栈上声明的元素添加到静态数组
- const_cast静态数组以添加恒常性
- 静态堆栈函数不会 1) 输入第一个元素 2)添加新元素时识别旧元素
- 如何将对象添加到类中的静态向量
- 如何从C++而不是虚幻编辑器中添加静态网格体组件的值?
- ctypes,添加静态库时未定义的符号
- 如何使用 PHP-CPP 在 PHP 类中添加静态数组
- iOS:添加静态库后C++应用大小太大
- 添加静态库时出现链接器错误
- 为什么添加静态数据成员会导致链接器失败
- 可以添加静态变量破坏 Linux 上的二进制兼容性
- VS2010-添加静态库时发生链接器错误
- 如何使用Xcode在c++项目中添加静态库
- Qt-creator 和 MSVC 无法添加(静态)库
- 在c# Unity3d中添加静态c++库
- 如何添加静态链接运行时程序集
- 在QtCreator中添加静态.a库