File_get_contents不工作? [英] File_get_contents not working?
问题描述
我使用cakephp。我试图从facebook使用file_get_contents获取数据。我收到警告。
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]:URL
文件访问在服务器中禁用
配置警告(2):
file_get_contents(https://graph.facebook.com/XXXXXXX/?access_token=111978178XXXXXX|2.lg65A3c0atficNsFcf7Rog__.3600.12799 XXXX-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
有任何方法可以取得资料吗?
Is there any way to get the data?
非常感谢任何帮助。
感谢。
推荐答案
在您的php.ini中,您可能有
In your php.ini you most probably have
allow_url_fopen = Off
如果要允许此操作,请将其设置为on。但是默认情况下它被关闭的原因是它更安全。
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不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!