php取xml文件里面的值

header("Content-Type:text/html;charset=utf-8");//不加header头中文会乱码
$fileContent = file_get_contents("http://tencent_serverlist.xml");
//转换为simplexml对象
$xmlResult = simplexml_load_string($fileContent);//XML 字符串载入对象中
$arr=json_encode($xmlResult);//取出的对象转成json 再转成数组
$arr= json_decode($arr,true);
echo "<pre>";
print_r($arr);exit;

https://blog.csdn.net/u013202077/article/details/69263065

猜你喜欢

转载自blog.csdn.net/qq_29058883/article/details/82258536