2012-11-17 21 views
23

我用下面的代碼如何檢查allow_url_fopen已被激活或不

echo 'file_get_contents : ', ini_get('allow_url_fopen') ? 'Enabled' : 'Disabled'; 

此可以得到它啓用或禁用

,但我想作出功能稱函數名_isgetcontents

然後我可以把它作爲我的網站代碼以下的任何地方

if (_isgetcontents()){ 
echo "this is enabled"; // will do an action 
}else{ 
echo "this is disabled"; // will do another action 
} 

〜感謝

回答

48

使用ini_get()獲得某些配置參數的值:

if(ini_get('allow_url_fopen')) { 
    // lucky me... 
} 
1

,你也可以用這個方法

phpinfo()函數

檢查各種配置。

相關問題