php xml转array的方法
php xml转array的方法
<pre>
<?php
$responseXml='<xml><appid>12</appid></xml>';
//simplexml_load_string 这个是xml转成对象
$responseObj = simplexml_load_string($responseXml, 'SimpleXMLElement', LIBXML_NOCDATA);
//对象转成数组
$responseObj = json_decode( json_encode( $responseObj),true);
print_r($responseObj);
?>
</pre>
如果遇到什么不懂的地方直接关注公众号留言(本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须在文章页面给出原文连接,否则保留追究法律责任的权利。)
作者:newmiracle
出处:https://www.cnblogs.com/newmiracle/

浙公网安备 33010602011771号