public function xmltoarr($path) {//xml字符串转数组 $xml= $path;//XML文件 $objectxml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA); $xmljson= json_encode($objectxml);//将对象转换个JSON $xmlarray=json_decode($xmljson, true);//将json转换成数组 return $xmlarray; }
标签:xml,解析,xmljson,json,objectxml,path,php From: https://www.cnblogs.com/hxmbk/p/16988905.html