数组 - 迅搜产出包含特殊object的array转化成一般PHP array

WBOY
发布: 2016-06-06 20:43:12
原创
1218 人浏览过

刚在用迅搜,产出了一个结果array A,里面包含了迅搜的特殊object,无法直接用于显示输出。怎样能把它转化成包含普通object的一般array B呢?

谢谢!

Array A:

<code>Array ( [0] => XSDocument Object ( [_data:XSDocument:private] => Array ( [id] => 65 [message] => cool book awesome [username] => lost guy [book] => my love....
[1] => XSDocument Object ( [_data:XSDocument:private] => Array ( [id] => 78 [message] => cool book awesome [username] => lost guy [book] => my love....)
</code>
登录后复制
登录后复制

我想得到的Array B 模样:

<code>Array ( [0] => StdClass Object ( Array ( [id] => 65 [message] => cool book awesome [username] => lost guy [book] => my love....
[1] => StdClass Object ( Array ( [id] => 78 [message] => cool book awesome [username] => lost guy [book] => my love....)
</code>
登录后复制
登录后复制

谢谢!Thanks a lot!

回复内容:

刚在用迅搜,产出了一个结果array A,里面包含了迅搜的特殊object,无法直接用于显示输出。怎样能把它转化成包含普通object的一般array B呢?

谢谢!

Array A:

<code>Array ( [0] => XSDocument Object ( [_data:XSDocument:private] => Array ( [id] => 65 [message] => cool book awesome [username] => lost guy [book] => my love....
[1] => XSDocument Object ( [_data:XSDocument:private] => Array ( [id] => 78 [message] => cool book awesome [username] => lost guy [book] => my love....)
</code>
登录后复制
登录后复制

我想得到的Array B 模样:

<code>Array ( [0] => StdClass Object ( Array ( [id] => 65 [message] => cool book awesome [username] => lost guy [book] => my love....
[1] => StdClass Object ( Array ( [id] => 78 [message] => cool book awesome [username] => lost guy [book] => my love....)
</code>
登录后复制
登录后复制

谢谢!Thanks a lot!

相关标签:
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!