好用的XML转换成数组方法

来源:互联网 时间:2017-06-16


xml代码
$xml="
wx2421b1c4370ec43b
ZHENGZHOU_BS
D00411
1262544101
13110
15112496832609
13110
8FF6CEF879FB9555CD580222E671E9D4
1006930610201511241751403478
0
CNY
15112496832609001
";
function xmlToArray2($xml) {
// 将XML转为array
$array_data = json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
return $array_data;
}
xml转换成数组后:
print_r(xmlToArray2($xml));

相关阅读:
Top