开发者

Is there an "or" in XPath selectors?

开发者 https://www.devze.com 2023-02-20 05:15 出处:网络
I am having the follow开发者_如何学Pythoning xPath that gets image from <div class=\"separator\">. My question is how can I make the xPath to search in <div class=\"entry\"> also?

I am having the follow开发者_如何学Pythoning xPath that gets image from <div class="separator">. My question is how can I make the xPath to search in <div class="entry"> also?

$img = $xpath->query('//div[@class="separator"]//img');

Thanks in advance :)


$img = $xpath->query('//div[@class="separator" or @class="entry"]//img');


$img = $xpath->query('//div[@class="separator"]//img | //div[@class="entry"]//img');


$img = $xpath->query('//div[@class="separator" or @class='entry']//img');
0

精彩评论

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