本地服务器上的PHP简单HTML DOM解析器
是什么导致“PHP简单HTML DOM解析器”无法在本地服务器上工作。这可能是配置问题吗 PHP版本7.2.12本地服务器上的PHP简单HTML DOM解析器,php,parsing,html-parsing,simple-html-dom,Php,Parsing,Html Parsing,Simple Html Dom,是什么导致“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() 串入。。。。。堆栈跟踪:#0{main}已抛出。。。。。在线
<?php
include('simple_html_dom.php');
$html = file_get_contents('http://www.google.com/');
$html->load($html);
?>
给出以下错误:
致命错误:未捕获错误:调用上的成员函数load()
串入。。。。。堆栈跟踪:#0{main}已抛出。。。。。在线
读取a(这始终是一个选项)表示在简单HTMLDOM的实例上调用load
函数
// Create a DOM object
$html = new simple_html_dom();
// Load HTML from a string
$html->load('<html><body>Hello!</body></html>');
作为旁注,还有更多的方法可以将内容加载到simple\u html\u dom
,比如file\u get\u html
Asstr\u get\u html
tryfile\u get\u html
而不是file\u get\u contents
您试图调用load
方法的$html
,即字符串
$html = new simple_html_dom();
$html->load(file_get_contents('http://www.google.com/'));