触发特定功能时,我会收到下一条通知:
Trying to get property of non-object in...
我的功能:
private function rate($form)
{
$score = 0;
$count = $form->find('input')->length;
$score += ($count >= 2 && $count <= 5) ? INPUT_COUNT_RATE : 0;
$count = $form->find('textarea')->length;
$score += $count == 1 ? TEXTAREA_COUNT_RATE : 0;
return $score;
}
有问题的行是具有find
功能的行。
回报var_dump
率:$form
object(simple_html_dom_node)[1062]...
可能是什么问题呢?