File_get_contents 不起作用?

File_get_contents not working?(File_get_contents 不起作用?)
本文介绍了File_get_contents 不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我正在使用 cakephp.我正在尝试使用 file_get_contents 从 facebook 获取数据.我收到警告.

I am using cakephp. I am trying get data from facebook using file_get_contents. I get a warning.

警告(2):file_get_contents()[function.file-get-contents]:网址在服务器中禁用文件访问配置警告(2):file_get_contents(https://graph.XXXXXXX/?access_token=111978178XXXXXX|2.lg65A3c0atficNsFcf7Rog__.3600.12799XXXX-1000

Warning (2): file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration Warning (2): file_get_contents(https://graph.facebook.com/XXXXXXX/?access_token=111978178XXXXXX|2.lg65A3c0atficNsFcf7Rog__.3600.12799XXXX-1000

有没有办法获取数据?

感谢您的帮助.

谢谢.

推荐答案

这是您服务器上的配置问题.

This is a configuration issue on your server.

在你的 php.ini 中你很可能有

In your php.ini you most probably have

allow_url_fopen = Off

如果您想允许这样做,请将其设置为开启.请注意,默认情况下关闭它的原因是它更安全.

If you want to allow this, set it to on. Be aware though that the reason it's turned off by default is that it's more secure.

一个常见的替代方法是使用 cURL;您可能想检查一下您的托管环境是否提供该服务.

A common alternative is to use cURL instead; you might want to check if your hosting environment offers that.

这篇关于File_get_contents 不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)