加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – file_get_contents()错误

发布时间:2020-12-13 18:19:04 所属栏目:PHP教程 来源:网络整理
导读:我在 PHP上使用file_get_contents,它会抛出一些错误: 我的代码 #try to fetch from remote$this-remotePath = "http://some-hostname.com/blah/blah.xml$fileIn = @file_get_contents($this-remotePath); 错误: Warning: file_get_contents() [function.fi
我在 PHP上使用file_get_contents,它会抛出一些错误:

我的代码

#try to fetch from remote
$this->remotePath = "http://some-hostname.com/blah/blah.xml
$fileIn = @file_get_contents($this->remotePath);

错误:

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /virtual/path/to/file/outputFile.php on line 127

Warning: file_get_contents(https://some-host-name/data/inputFile.xml) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in /virtual/path/to/file/outputFile.php on line 127

任何的想法?它在我的计算机上工作正常但在我将其移植到Web服务器时停止工作.

您的服务器必须将 allow_url_fopen属性设置为true.在免费的虚拟主机上解释它,因为它通常被禁用以防止滥用.如果您为托管付费,请与您的主机联系,以便他们为您启用.

如果无法更改该设置,请查看cURL库.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读