$str1 = '
1
';
//处理xml字符串
$str = str_replace('', '', $str1);
//把xml转化成多个...格式的数组
preg_match_all('/\.+\/', $str, $arr);
$axml = [];
//遍历处理得到的数组
foreach ($arr[0] as $value) { //遍历解析得到的数组
//得到一个假key
preg_match_all('/\/', $value, $ks);
//处理假key
$k = substr($ks[0][0],1,-1);
//得到一个假value
preg_match_all('/\>\<.>\', $value, $vs);
//处理假value
if (empty($vs[0][0])) {
preg_match_all('/\>\w+\', $value, $v1);
$v = substr($v1[0][0],1,-1);
}else{
$v = substr($vs[0][0],10,strlen($vs[0][0])-14);
}
$axml[$k] = $v;
}
var_dump($axml);