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);

 

posted @ 2016-04-21 15:13  inc  阅读(6101)  评论(0编辑  收藏  举报