开发者

DOMDocument xpath query image extention doesnt equal to specific ext?

开发者 https://www.devze.com 2023-04-01 15:20 出处:网络
getting all images aprt from png extension? $xpath = new DOMXP开发者_StackOverflow中文版ath( $htmlget);

getting all images aprt from png extension?

$xpath = new DOMXP开发者_StackOverflow中文版ath( $htmlget);
       $nodelist = $xpath->query("//img[!ends-with(@src, "png")]");

i know this doesnt work, i want to be able to skip images which are png's


NOT in xpath is a function, not an operator. Try:

//img[not(ends-with(@src, 'png'))]

Also note I have changed from double-quotes "" to single quotes '' as the xpath string itself is delimited by "".

0

精彩评论

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