Home  >  Article  >  php教程  >  十行代码将xml转成数组

十行代码将xml转成数组

WBOY
WBOYOriginal
2016-06-07 11:39:331033browse

自己写的一个xml转数组的方法
大家如果有更简单的方法,欢迎回帖function xml2array($filename){<br>     $xml = @simplexml_load_file($filename);<br>     //返回数组<br>     if(is_object($xml)){<br>         $xml = json_encode($xml);<br>         $xml = json_decode($xml, true);<br>     }<br>     if(!is_array($xml)) $xml = null;<br>     return $xml;<br> }

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn