php打印xml格式数据

在你要输出的xml前边加      
header("Content-type:text/xml;charset=utf-8");
这个上边不要有任何输出

打印用echo 别用var_dump print_r之类的。。。

顺手记录下xml转数组

$xml = simplexml_load_string($data,NULL,LIBXML_NOCDATA);
$array=json_decode(json_encode($xml),true);
原文地址:https://www.cnblogs.com/inc-is-include/p/5417045.html