/**
* 将xml转为array
* @param string $xml
* @throws Exception
*/
public function FromXml($xml)
{
  if (!$xml) {
    throw new Exception("xml数据异常!");
  }
  //将XML转为array
  //禁止引用外部xml实体
  libxml_disable_entity_loader(true);
  return json_decode(json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
}

05-11 20:08