php十行代碼將xml轉成數組,大家如果有更簡單的方法,歡迎回復。
function xml2array($filename){
$xml = @simplexml_load_file($filename);
//返回數組
if(is_object($xml)){
$xml = json_encode($xml);
$xml = json_decode($xml, true);
}
if(!is_array($xml)) $xml = null;
return $xml;
}
新聞熱點
疑難解答