Home  >  Article  >  Backend Development  >  PHP将解析xml变为数组方法

PHP将解析xml变为数组方法

WBOY
WBOYOriginal
2016-06-23 13:18:48876browse

最近想要做一个插件机制,需要用到xml,在解析xml时候需要转换为数组,特意记录一个此种解析方式

xml文件

$xml =simplexml_load_string($xmls);

$xmljson= json_encode($xml);

$xml=json_decode($xmljson,true);

dump($xml);

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