PHP HTML DOM解析XML第二个结果 [英] PHP HTML DOM to parse XML second result

查看:97
本文介绍了PHP HTML DOM解析XML第二个结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用简单的PHP HTML DOM解析XML,这是因为存在多个具有相同值的标签,我如何仅显示第二个标签?

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?

推荐答案

我从您的问题中猜测您正在使用PHP Simple HTML DOM? http://simplehtmldom.sourceforge.net/

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];

如果您不使用PHP Simple HTML DOM,请告诉我们您使用的是哪个,因为根据您使用的代码的不同,它会有所不同.

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.

这篇关于PHP HTML DOM解析XML第二个结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆