《PHP教程:php使用simplexml_load_file加載XML文件并顯示XML的方法》要點:
本文介紹了PHP教程:php使用simplexml_load_file加載XML文件并顯示XML的方法,希望對您有用。如果有疑問,可以聯系我們。
PHP實例本文實例講述了php使用simplexml_load_file加載XML文件并顯示XML的辦法.分享給大家供大家參考.具體實現辦法如下:
PHP實例
<?php
$xml = simplexml_load_file("sample.xml");
echo htmlspecialchars($xml->asXML());
?>
PHP實例sample.xml文件內容如下
PHP實例
<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程序設計有所贊助.
歡迎參與《PHP教程:php使用simplexml_load_file加載XML文件并顯示XML的方法》討論,分享您的想法,維易PHP學院為您提供專業教程。