如何检查allow_url_fopen是否启用 [英] How to check if allow_url_fopen is enabled or not

查看:136
本文介绍了如何检查allow_url_fopen是否启用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码

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

这可以启用或禁用它

但是我想让函数说函数名是_isgetcontents

but I would like to make as function say function name is _isgetcontents

然后我可以在网站代码中的任意位置调用它

then I can call it as following any where in my website code

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

推荐答案

使用 ini_get() 来获取某些配置参数的值:

Use ini_get() to get the value of certain configuration parameters:

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

这篇关于如何检查allow_url_fopen是否启用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆