我试图获取div的索引,其中包含'商店名称' 像:
$doc = phpQuery::newDocument($shops_page);
echo $shop_index = $doc->find(".shop_item:contains('Shop Name')")->index();
在JQuery $(".shop_item:contains('Shop Name')").index();
中起作用
如何使用phpquery找到索引?
答案 0 :(得分:0)
if ($doc->find(".shop_item:contains('Shop Name')")->length()){
$shop_index = $doc->find(".shop_item")->index(pq($doc->find(".shop_item:contains('.shop_item:contains('Shop Name')')")));
}