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的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:
<?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錯誤,經(jīng)過百度發(fā)現(xiàn)是php不支持gd庫,linux服務器需要重新make,windows下比較簡單了,下面是具體的方法2021-09-09
php源碼分析之DZX1.5隨機數(shù)函數(shù)random用法
這篇文章主要介紹了php源碼分析之DZX1.5隨機數(shù)函數(shù)random用法,實例分析了DZX1.5中random函數(shù)生成隨機字符串的使用技巧,需要的朋友可以參考下2015-06-06
PHP使用curl_multi_select解決curl_multi網(wǎng)頁假死問題的方法
這篇文章主要介紹了PHP使用curl_multi_select解決curl_multi網(wǎng)頁假死問題的方法,結合實例形式分析了使用curl_multi的過程中并發(fā)處理事務導致cpu占用率過高時的解決方法,需要的朋友可以參考下2018-08-08

