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);
http://news.baidu.com/ns?word=title%3A%CE%CD%B0%B2&tn=newsrss&sr=0&cl=2&rn=20&ct=0
转换不正确 2 楼 spamer 2011-11-26 百度返回的编码是gb2312的,改成,utf-8 即可