`

php最简单把xml转换成数组的方法

阅读更多

php最简单把xml转换成数组的方法

 

<?php
$str='<xml><node><![CDATA[content]]></node></xml>';
$res = @simplexml_load_string($str,NULL,LIBXML_NOCDATA);
$res = json_decode(json_encode($res),true);
print_r($res);

分享到:
评论
2 楼 spamer 2011-11-26  
百度返回的编码是gb2312的,改成,utf-8 即可
1 楼 xxfaxy 2011-10-24  
百度的rss不能用
http://news.baidu.com/ns?word=title%3A%CE%CD%B0%B2&tn=newsrss&sr=0&cl=2&rn=20&ct=0
转换不正确

相关推荐

Global site tag (gtag.js) - Google Analytics