xml轉成陣列,原來這麼簡單!

weixin_34120274發表於2015-05-26
  1. function xml2arr($xml){
  2.     $obj  = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
  3.     $json = json_encode($obj);
  4.     $arr  = json_decode($json, true);
  5.     return $arr;
  6.  }

相關文章