php 读取 xml 文件

 时间:2024-10-13 11:17:18

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;

  • window7安装webpack4.8
  • linux教程:[2]Ubuntu安装zookeeper
  • 教你如何使用PHP中的变量
  • Eclipse安装svn插件(离线版)
  • Eclipse安装maven插件配置本地仓库
  • 热门搜索
    怎么蒸馒头 浪琴手表怎么样 日语我爱你怎么说 怎么治疗失眠 嘴苦是怎么回事 笔记本小键盘怎么关 英语作文怎么写 有贷款的房子怎么卖 环境用英语怎么说 牙齿过敏怎么治疗