我正在使用Simple_html_dom
尝试抓取Reputation points
并检查这些值,然后仅提取Repu
大于200
的用户个人资料。下面是代码,这样做时工作正常
`
$html2=str_get_html($html1);
foreach ($html2->find('.user-details') as $value) {
foreach($html2->find('.reputation-score') as $repu){
echo (int)$repu->plaintext.$value.'<br>';
}
}
When doing the above i am getting all the
信誉和用户详细信息well each line, looks fine till now. But now i wanna perform a
条件检查and then echo only those profiles whose repo is higher than
100`。所以当我尝试下面的代码时
`
$html2=str_get_html($html1);
foreach ($html2->find('.user-details') as $value) {
foreach($html2->find('.reputation-score') as $repu){
if($repu>100)
{
echo ($repu->plaintext.$value.'<br>';
}
}
}
我收到一条错误,说类simple_html_dom_node的对象无法转换为int ,因为我已尝试执行(int)
转换,然后echo仍然无法解决
这里有任何帮助吗?