在数据结构中添加 stdClass 对象
stdClass::__set_state(array(
'zone1' =>
array (
0 =>
stdClass::__set_state(array(
'id' => '123',
'owner' => '234',
...
)),
我的基础知识有点少,所以我遇到了麻烦...我需要创建上述结构,但我不知道如何...
stdClass::__set_state(array(
'zone1' =>
array (
0 =>
stdClass::__set_state(array(
'id' => '123',
'owner' => '234',
...
)),
My basics are a bit shot, so I'm having trouble with this... I need to create the above structure, but I'm not sure how to...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
或者,依赖于数组在转换为对象时会转换为 stdClass 对象的事实:
为此,
var_export
给出:请注意,丹尼尔是否已指出,
stdClass
没有'实际上有一个 __set_state 方法。我想您只是通过给出 var_export 的输出来举例说明变量的结构。序列化应该使用serialize
来完成。Alternatively, relying upon the fact that arrays are converted to stdClass objects when casted into objects:
For this,
var_export
gives:Note that, has Daniel has pointed out,
stdClass
doesn't actually have a__set_state
method. I supposed you were just exemplifying the structure of the variable by giving the output ofvar_export
. Serialization should be done withserialize
instead.