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; }