douye6812 2017-07-09 14:16
浏览 51

致命错误:在第14行的/home/admin/web//public_html/index.php中调用boolean上的成员函数find()[复制]

This question already has an answer here:

PHP Simple HTML DOM Parser

Fatal error: Call to a member function find() on boolean in /home/admin/web//public_html/index.php on line 14

Why does it fail?

include("simple_html_dom.php");

$html = file_get_html('http://en.wikipedia.org/wiki/facebook');

$title = $html->find('h1[id=firstHeading]',0)->innertext; 

echo $title;
</div>
  • 写回答

1条回答 默认 最新

  • dt246813579 2017-07-09 14:32
    关注

    I am not familiar with file_get_html but it probably returns false on errors, so you should check the returned value:

    if ($html === false) {
       // check what the error is (look for file_get_html documentation to understand how to get more info on the error
    } else {
       // file is ok, process it
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效