发布于 2016-02-29 00:36:54 | 240 次阅读 | 评论: 0 | 来源: PHPERZ

这里有新鲜出炉的精品教程,程序狗速度看过来!

XML可扩展标记语言

xml 即 可扩展标记语言 。 可扩展标记语言,标准通用标记语言的子集,一种用于标记电子文件使其具有结构性的标记语言。


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

   xml文件

<?xml version="1.0" encoding="UTF-8"?>
<main xmlns="http://www.xiaoetongo.cn" versionCode="1.0">
<controller co="Aritles">
<meth title="测试插件" do="aritle"/>
</controller>
<controller co="Ari">
<meth title="测试插件" do="ar"/>
<meth title="测试插件" do="a"/>
</controller>
<install><![CDATA[]]></install>
<upgrade><![CDATA[]]></upgrade>
</main>

<?php

$xml =simplexml_load_string($xmls);
$xmljson= json_encode($xml);
$xml=json_decode($xmljson,true);
dump($xml);



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务