DOMDocument xpath query image extention doesnt equal to specific ext?
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 ""
.
精彩评论