【发布时间】:2019-05-17 00:31:59
【问题描述】:
可能导致“PHP 简单 HTML DOM 解析器”在本地服务器上无法工作的原因。会不会是配置问题?
PHP 版本 7.2.12
<?php
include('simple_html_dom.php');
$html = file_get_contents('http://www.google.com/');
$html->load($html);
?>
给出以下错误:
致命错误:未捕获的错误:调用成员函数 load() on string in ..... Stack trace: #0 {main} throw in ..... on line .....
【问题讨论】:
-
试试
file_get_html而不是file_get_contents -
您试图调用
load的$html方法,即字符串
标签: php parsing html-parsing simple-html-dom