php使用simplexml_load_file加载XML文件并显示XML的方法
更新时间:2015年03月19日 16:49:42 作者:work24
这篇文章主要介绍了php使用simplexml_load_file加载XML文件并显示XML的方法,实例分析了simplexml_load_file操作XML文件的技巧,非常具有实用价值,需要的朋友可以参考下
本文实例讲述了php使用simplexml_load_file加载XML文件并显示XML的方法。分享给大家供大家参考。具体实现方法如下:
<?php
$xml = simplexml_load_file("sample.xml");
echo htmlspecialchars($xml->asXML());
?>
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>
希望本文所述对大家的php程序设计有所帮助。
相关文章
php遇到错误Call to undefined function ImageCreate()解决方法
刚配置好服务器,运行php的时候提示Call to undefined function imagecreate错误,经过百度发现是php不支持gd库,linux服务器需要重新make,windows下比较简单了,下面是具体的方法2021-09-09
PHP使用curl_multi_select解决curl_multi网页假死问题的方法
这篇文章主要介绍了PHP使用curl_multi_select解决curl_multi网页假死问题的方法,结合实例形式分析了使用curl_multi的过程中并发处理事务导致cpu占用率过高时的解决方法,需要的朋友可以参考下2018-08-08


最新评论