我想读从最终的XML文件开始想我的XML这样开始:读取结束XML文件中的PHP
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
<note>
<to>Samy</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't Miss me this weekend!</body>
</note>
我需要阅读最后一个音符首先我使用的代码一样,
$x = $xmldoc->getElementsByTagName('note');
$nofnews = $xmldoc->getElementsByTagName('note')->length;
for ($i = 0; $i < $nofnews; $i++) {
$item_title = $x->item($i)->getElementsByTagName('to')
->item(0)->nodeValue;
$item_link = $x->item($i)->getElementsByTagName('from')
->item(0)->nodeValue;
}
预先感谢您
你只需要先读最后一个音符的节点,或第一的最后一个音符节点,然后返回到第一? – hakre