我正在使用 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 不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
不能使用 'Object 作为类名,因为它是保留的Cannot use #39;Object as class name as it is reserved Cake 2.2.x(不能使用 Object 作为类名,因为它是保留的 Cake 2.2.x)
OAuth 重定向后会话丢失Session is lost after an OAuth redirect(OAuth 重定向后会话丢失)
Cakephp 3.x 中的分页排序Pagination Sort in Cakephp 3.x(Cakephp 3.x 中的分页排序)
CakePHP 多个应用程序的共享核心CakePHP Shared core for multiple apps(CakePHP 多个应用程序的共享核心)
在 CakePHP 3 上登录 [ Auth->identify() ] 始终为 falLogin [ Auth-gt;identify() ] always false on CakePHP 3(在 CakePHP 3 上登录 [ Auth-identify() ] 始终为 false)
致命错误:允许的内存大小为 134217728 字节已用尽Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 87 bytes)(致命错误:允许的内存大小为 134217728 字节已用尽