最新下载
热门教程
- 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
相关文章
- 96345如何助你快速找到钟点工 03-29
- 我的常德app如何交学费 03-29
- 如何登录网易163免费邮箱 03-29
- 腾讯会议直达入口地址在哪 03-29
- 小宇宙app如何标记喜欢的单集 03-29
- 如何查看12306已完成订单详情 03-29