php使用simpleXML打印xml元素实现方法
内容摘要
这篇文章主要为大家详细介绍了php使用simpleXML打印xml元素实现方法,具有一定的参考价值,可以用来参考一下。
对php使用simpleXML打印xml元素对此感兴趣的朋友,看看idc笔记做
对php使用simpleXML打印xml元素对此感兴趣的朋友,看看idc笔记做
文章正文
这篇文章主要为大家详细介绍了php使用simpleXML打印xml元素实现方法,具有一定的参考价值,可以用来参考一下。
对php使用simpleXML打印xml元素对此感兴趣的朋友,看看idc笔记做的技术笔记!1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <code class = "php" > /** * php使用simpleXML打印xml元素 * * @param * @arrange 512-笔记网: www.idcnote.com **/ <?php $xml = simplexml_load_file( "books.xml" ); foreach ( $xml ->book[0]->author->attributes() AS $a => $b ) { echo "$a = $b <br />" ; } ?> /*** 来自php教程(www.idcnote.com) ***/ </code> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <code class = "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> --> </code> |
注:关于php使用simpleXML打印xml元素实现方法的内容就先介绍到这里,更多相关文章的可以留意
代码注释