PHP文件名不能为空如何在简单的html dom行70中绕过它


PHP Filename cannot be empty how to bypass that in simple html dom line 70

当我抓取一个网站时,我能够从10000个内容中抓取4000个内容,它会停止并说

PHP警告:file_get_contents():中的文件名不能为空/用户。。。第70行的simple_html_dom.php php致命错误:调用非对象上的成员函数find()

在simple_html_dom.php 的第70行

$contents = file_get_contents($url, $use_include_path, $context, $offset);

我想知道如何绕过空文件名,继续完成这个过程?

$contents = '';
if(!empty($url)) {
    $contents = file_get_contents($url, $use_include_path, $context, $offset);
}

您可能只需要确保$url有一个值。。。

if(!empty($url)) {
    $contents = file_get_contents($url, $use_include_path, $context, $offset);
}