我试图在p元素的class属性中匹配一个简单的子字符串,但得到了错误:
$pElements = $crawler2
->filter(
"p[contains(@class, 'price')]");
// Expected operator, but <delimiter "(" at 10> found
// "descendant-or-self::p[contains(@class, 'price')");
// Unexpected pseudo-element "::p" found not at the end of a selector我从这里得到的第二个(注释)选择语句的前缀是:https://symfony.com/doc/current/components/css_selector.html
我在PHP中使用这个库和Goute进行web抓取。
从错误(在服务器错误日志中)看起来xpath是坏的。有没有人能看出其中的错误?
发布于 2019-04-09 07:50:56
首先,你没有结束的]括号
尝试此字符串:在filter函数中使用"p[contains(@class, 'price')]"
https://stackoverflow.com/questions/55583231
复制相似问题