123456789public function xmlArray($xml){ if(!$xml){ $data="数据异常"; error\_log("数据错误".print\_r($data)."\\r\\n",3,'wx\_error.log'); exit; } //将XML转为array //禁止引用外部xml实体 libxml\_disable\_entity\_loader(true);$data= json\_decode(json\_encode(simplexml\_load\_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true); return $data; }