file_get_contents():流不支持查找/有关此的PHP行为何时更改? [英] file_get_contents(): stream does not support seeking / When was PHP behavior about this changed?

查看:90
本文介绍了file_get_contents():流不支持查找/有关此的PHP行为何时更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PHP的行为何时更改?

它是哪个PHP版本?

警告:file_get_contents():流不支持在 /simple_html_dom.php

Warning: file_get_contents(): stream does not support seeking in /simple_html_dom.php

警告:file_get_contents():无法在以下位置找到流中的-1 /simple_html_dom.php

Warning: file_get_contents(): Failed to seek to position -1 in the stream in /simple_html_dom.php


include('parser/simple_html_dom.php');
$url = "https://en.wikipedia.org/wiki/Stack_Overflow";
$html = file_get_html($url);
if ($html !== false) {
  foreach($html->find('div#mw-content-text') as $item){
    $item->plaintext;
  }
}

推荐答案

请参见您正在使用远程文件.仅本地文件支持查找.

You are working with a remote file. Seeking is only supported for local files.

在使用file_get_html之前,您可能需要将文件复制到本地文件系统.在localhost上应该可以正常工作.

You probably need to copy the file to your local file system before using file_get_html. It should work fine on localhost.

这篇关于file_get_contents():流不支持查找/有关此的PHP行为何时更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆