致命错误:在非对象中调用成员函数find()

时间:2014-03-04 10:43:04

标签: php

将产品导入opencart时出现此错误。

有人可以建议代码需要更正的位置吗?

// Find the DIV tag with an id of "myId"
    foreach($html->find('div#accordion') as $e)
        return $e->innertext;
}

1 个答案:

答案 0 :(得分:0)

错误的含义是

  

$ HTML

不是对象。

php documentation你可以测试像这样的对象

if (!is_object($html)) {
    return false;
}else{
foreach($html->find('div#accordion') as $e){
return $e->innertext;
   }
}