PHP HTML DOM to parse XML second result

一个人想着一个人 提交于 2019-12-13 01:34:38

问题


I'm using simple PHP HTML DOM to parse XML, it is that there are several tags with the same values​​, how I can display only the second label?


回答1:


I'm guessing from your question you're using PHP Simple HTML DOM? http://simplehtmldom.sourceforge.net/

You should be able to get the second label by doing something like:

// $xml is your DOM object
$tags = $xml->find("label");
echo $tags[1];

If you're not using PHP Simple HTML DOM, let us know which you're using, as it'll be different depending on the code you're using.



来源:https://stackoverflow.com/questions/6872418/php-html-dom-to-parse-xml-second-result

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!