×

php xml 转 array

chen chen 发表于2021-07-27 22:36:33 浏览1021 评论0

抢沙发发表评论

$ndata = json_decode(json_encode((array) simplexml_load_string($xml)),1);
print_r($ndata);
2个方法是一样的
/*$xmlstring = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
$val = json_decode(json_encode($xmlstring),true);


群贤毕至

访客