0
我試圖在XPath中使用OR運算符,它適用於Chrome Inspect。但它使它無法在PHP上工作。沒有OR運算符的初始XPath在PHP中工作得很好。XPath在Chrome Inspect中運行,但不在PHP中
這是初始的XPath:
//h4[text()="Description"]/following-sibling::*[not(@class)][not(@style)]
這是改性的XPath
//h4[text()="Description"]/following-sibling::*[not(@class)|@class="MsoNormal"][not(@style)]
我用了這個鏈接
http://websiteproperties.com/websites/13425-trademarked-brand-mens-personal-care-product-amazon-fba/
改性的XPath後,我從PHP腳本中得到這個錯誤:
Warning: DOMXPath::query(): Invalid type in D:\xampp\htdocs\PHP projects\Centurica\centurica\lib\custom\class_ff_parser.php on line 660
Warning: DOMXPath::query(): Invalid expression in D:\xampp\htdocs\PHP projects\Centurica\centurica\lib\custom\class_ff_parser.php on line 660
請提供一個可用於重現問題的XML和您的代碼的小例子。 – ThW