[php怎么取读xml文件内容]php怎么取读xml文件

时间:2015-06-10  来源:Dom教程  阅读:

$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 - $publishern";
}
?>

[php怎么取读xml文件内容]php怎么取读xml文件

http://m.bbyears.com/wangyezhizuo/15731.html

推荐访问:
相关阅读 猜你喜欢
本类排行 本类最新