开发者

Simple html dom parser

I use simple php dom parser. I have a link in my loaded dom which looks like this (in html):

<a href="...开发者_开发百科">Some const tesxt</a>

How can I select this object using find function? Maybe I can pass regular expression which looks at a container text? Btw, it's static(constant) text and I want to search need link refer to that text.


Reading through the Manual it should give you all you need to know.

$ret = $html->find('a');

foreach ($ret as $link) {
    if ($link->innertext == 'Someconst tesxt') {
          // do what you must.
    }
}

Not sure what else you are looking for, but I am not able to test the above, just put it together from reading the manual.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜