SimpleXMLElement Object
(
[user] => SimpleXMLElement Object
(
[alipay_account] => 186165713811
[alipay_bind] => bind1
[alipay_no] => 208860222631333101561
[buyer_credit] => SimpleXMLElement Object
(
[good_num] => 0
[level] => 0
[score] => 0
[total_num] => 0
) [consumer_protection] => false
[created] => 2011-06-01 15:46:55
[email] => SimpleXMLElement Object
(
) [last_visit] => 2011-06-15 15:38:34
[location] => SimpleXMLElement Object
(
) [nick] => 商城
[seller_credit] => SimpleXMLElement Object
(
[good_num] => 0
[level] => 0
[score] => 0
[total_num] => 0
) [status] => normal
[type] => C
[uid] => a2133f8fea55225a81f2b843f609d9ec1
[user_id] => 7144516691
))
上面是哪里,我该如何用循环显示出对应的字段值啊?
(
[user] => SimpleXMLElement Object
(
[alipay_account] => 186165713811
[alipay_bind] => bind1
[alipay_no] => 208860222631333101561
[buyer_credit] => SimpleXMLElement Object
(
[good_num] => 0
[level] => 0
[score] => 0
[total_num] => 0
) [consumer_protection] => false
[created] => 2011-06-01 15:46:55
[email] => SimpleXMLElement Object
(
) [last_visit] => 2011-06-15 15:38:34
[location] => SimpleXMLElement Object
(
) [nick] => 商城
[seller_credit] => SimpleXMLElement Object
(
[good_num] => 0
[level] => 0
[score] => 0
[total_num] => 0
) [status] => normal
[type] => C
[uid] => a2133f8fea55225a81f2b843f609d9ec1
[user_id] => 7144516691
))
上面是哪里,我该如何用循环显示出对应的字段值啊?
解决方案 »
- osticket 有朋友用么?
- 类似google form的程序?
- 通达OA文件解密后,仍有几个文件中带有不可识别的代码
- 多用户博客,用什么开源程序做二次开发比较好?
- 急!!!谁来帮忙调调js省市二级联动代码?以下代码可以分别在火狐和IE里运行,但是在IE中兼容性不好,谁来帮忙改改啊?
- wordpress 链接问题
- PHP has encountered an Access Violation at 0230E286
- PHP的用途
- php为什么插入不了中文
- php网站title
- Flash+xml的相册上传图片后xml怎么生成该图片的数据???
- linux环境下php将word文件,转换成mht格式,有没有办法啊?
$xml = simplexml_load_file($fileName);
$xml = (array)$xml;
print_r($xml); //输出的结果为:
Array
(
[msg_code] => 3
[msg] => 服务器端还有数据文件需要下载,请继续调用本接口下载数据文件
[fileInfos] => SimpleXMLElement Object
(
[hashAlgorithm] => 0
[compressionFormat] => 0
[encryptAlgorithm] => 1
)
)对比一下,上面的代码仅添加了一行 $xml = (array)$xml;
此时输出的内容中,第7行,已经由SimpleXMLElement Object 变为 Array 了。
其实就这么简单,只需要在需要调用的时候前用(array)转化为常规数组即可正常调用。