xml转换为数组格式

function xmltoarr($path){//xml字符串转数组
$xmlfile = file_get_contents($path);//提取xml文档中的内容以字符串格式赋给变量
$ob= simplexml_load_string($xmlfile,'SimpleXMLElement', LIBXML_NOCDATA);//将字符串转化为变量
$json = json_encode($ob);//将对象转化为JSON格式的字符串
$configData = json_decode($json, true);//将JSON格式的字符串转化为数组
return $configData;
}
原文地址:https://www.cnblogs.com/wzjdy/p/7998813.html