【发布时间】:2019-03-27 10:41:15
【问题描述】:
我收到如下错误。
file_get_contents():流不支持搜索
我由作曲家安装了 simple_dom:
composer require sunra/php-simple-html-dom-parser
也用过这个:
use Sunra\PhpSimple\HtmlDomParser;
这是我的代码:
$weblink = "http://www.sumitomo-rd-mansion.jp/kansai/";
function fetch_sumitomo_links($weblink)
{
$htmldoc = HtmlDomParser::file_get_html($weblink);
foreach ($htmldoc->find(".areaBox a") as $a) {
$links[] = $a->href . '<br>';
}
return $links;
}
$items = fetch_sumitomo_links($weblink);
print_r($items);
但我遇到了一个错误。任何想法? 感谢您的帮助!
【问题讨论】:
-
为什么不像其他人一样使用 DOMDocument 呢? php.net/manual/en/class.domdocument.php
-
@UdhavSarvaiya 对不起,伙计,但我不明白你所说的
file_get_contents.php、simple_html_dom.php是什么意思,所以,这些在 Laravel 中的哪个文件夹?还是我需要安装这些,因为关于 simple_dom 安装没有记录。