php使用simplexml_load_file加载XML文件,并显示的简单示例

PHP使用simplexml_load_file加载XML文件,并显示XML感兴趣的小伙伴,下面一起跟随编程之家 jb51.cc的小编两巴掌来看看吧!

/**
 * PHP使用simplexml_load_file加载XML文件,并显示XML
 *
 * @param 
 * @arrange 512-笔记网: 512Pic.com
 **/
$xml = simplexml_load_file(sample.xml);
echo htmlspecialchars($xml->asXML());

/***   来自编程之家 jb51.cc(jb51.cc)   ***/
sample.xml文件内容如下

<library>
<book>
  <title>A</title>
  <author gender=female>B</author>
  <description>C</description>
</book>
<book>
  <title>C</title>
  <author gender=male>D</author>
  <description>E</description>
</book>
<book>
  <title>F</title>
  <author gender=male>G</author>
  <description>H</description>
</book>
</library>

相关文章

统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...
前言 之前做了微信登录,所以总结一下微信授权登录并获取用户...
FastAdmin是我第一个接触的后台管理系统框架。FastAdmin是一...
之前公司需要一个内部的通讯软件,就叫我做一个。通讯软件嘛...
统一支付是JSAPI/NATIVE/APP各种支付场景下生成支付订单,返...