問題描述
我正在使用 cakephp.我正在嘗試使用 file_get_contents 從 facebook 獲取數(shù)據(jù).我收到警告.
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]:網(wǎng)址在服務(wù)器中禁用文件訪問配置警告(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
有沒有辦法獲取數(shù)據(jù)?
感謝您的幫助.
謝謝.
推薦答案
這是您服務(wù)器上的配置問題.
This is a configuration issue on your server.
在你的 php.ini 中你很可能有
In your php.ini you most probably have
allow_url_fopen = Off
如果您想允許這樣做,請將其設(shè)置為開啟.請注意,默認(rèn)情況下關(guān)閉它的原因是它更安全.
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;您可能想檢查一下您的托管環(huán)境是否提供該服務(wù).
A common alternative is to use cURL instead; you might want to check if your hosting environment offers that.
這篇關(guān)于File_get_contents 不起作用?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!