php 读取 xml 文件
1、假设myxml.垓矗梅吒xml文件中的内容如下 <resource> <res>this is value</res媪青怍牙> <sound>sound.ogg</sound> </resource>
2、首先我们读取这个xml文件的内容$xml = file_get_contents('myxml.xml');
3、最重要的一步:解析这个xml文件$xml_obj = simplexml_load_string($xml);
4、好了,我们现在有了$xml_obj,我们就可以按照xml文件的结构读取数据了://输出 "this is value&鳎溻趄酃quot;echo $xml_obj->res;//输出 "sound.ogg"echo $xml_obj->sound;
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:34
阅读量:32
阅读量:27
阅读量:58
阅读量:91