时间:2021-07-01 10:21:17 帮助过:27人阅读
class Foo { protected $bar = []; }
注意不是在构造函数里初始化的哦亲~
先剧透一下……如果直接使用zend_declare_property来初始化一个属性为空数组,会得到以下错误:
Fatal error: Internal zval's can't be arrays, objects or resources in Unknown on line 0
需求类似下面的php代码:
class Foo { protected $bar = []; }
注意不是在构造函数里初始化的哦亲~
先剧透一下……如果直接使用zend_declare_property来初始化一个属性为空数组,会得到以下错误:
Fatal error: Internal zval's can't be arrays, objects or resources in Unknown on line 0
构造函数, 或者create handler中去初始化,,,这是问题还是?
class Foo { protected $bar = array(); }