<Product>
<Price>
<SalePrice>
14,95
</SalePrice>
</Price>
</Product>
<Product>
<Price>
<SalePrice>
16,95
</SalePrice>
</Price>
</Product>
$response->xpath('Product/Price/[SalePrice <= "16,95"]/parent::*
您好,我想要每个销售价格等于或低于 16,95,如我的示例中所示。但每次我尝试时,它都会给出一个空数组。如果我只使用:
$response->xpath('Product/Price/[SalePrice = "16,95"]/parent::*
我得到了结果。我希望你能帮助我解决这个问题。谢谢
将结果与浮点数而不是字符串进行比较
//产品/价格/销售价格[number(translate(.,',','.'))<= 16.95]/parent::*