最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
简短的php读取xml详细代码
时间:2022-11-14 23:01:46 编辑:袖梨 来源:一聚教程网
$doc = new DOMDocument();
$doc->load( 'books.xml' );
$books = $doc->getElementsByTagName( "book" );
foreach( $books as $book )
{
$authors = $book->getElementsByTagName( "author" );
$author = $authors->item(0)->nodeValue;
$publishers = $book->getElementsByTagName( "publisher" );
$publisher = $publishers->item(0)->nodeValue;
$titles = $book->getElementsByTagName( "title" );
$title = $titles->item(0)->nodeValue;
echo "$title - $author - $publisher ";
echo "
";
}
?>
xml文件
Jack Herrington
Jack Herrington
相关文章
- 物华弥新莲塘乳鸭图如何玩 09-04
- 偃武貂蝉角色怎么样 09-04
- 星之旅人赫兰角色有哪些技能 09-04
- 七日世界闪电基因织物有什么作用 09-04
- 全明星街球派对詹姆斯哪些玩法技巧 09-04
- 偃武甘宁怎么培养 09-04