开发者

PHP: simple_html_dom - how to find elements that are NOT in a certain class?

开发者 https://www.devze.com 2023-03-24 04:52 出处:网络
I\'m using simple_html_dom in PHP to get all A-tags inside a html page. But some tags are inside a div that should be ignored.

I'm using simple_html_dom in PHP to get all A-tags inside a html page. But some tags are inside a div that should be ignored.

I guess I need something like :

$htmldom->find("!div[class=blabla] a");

I found that I can use [attribute!=value] to specify elements that do NOT have a certain attrib开发者_开发百科ute value, but how would this work for elements?


You basically had it:

$htmldom->find("[class!=blabla] a");
0

精彩评论

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

关注公众号