Bre*_*ent 40
<?php
function exec_enabled() {
$disabled = explode(',', ini_get('disable_functions'));
return !in_array('exec', $disabled);
}
?>
Run Code Online (Sandbox Code Playgroud)
编辑:根据Ziagl的评论修正了爆炸.
Dan*_*sor 13
以下功能更加强大.它处理disabled_functions函数名之间具有0或更多空格的值,检查suhosin补丁的黑名单设置,覆盖safe_mode并存储答案以供将来参考.
function is_exec_available() {
static $available;
if (!isset($available)) {
$available = true;
if (ini_get('safe_mode')) {
$available = false;
} else {
$d = ini_get('disable_functions');
$s = ini_get('suhosin.executor.func.blacklist');
if ("$d$s") {
$array = preg_split('/,\s*/', "$d,$s");
if (in_array('exec', $array)) {
$available = false;
}
}
}
}
return $available;
}
Run Code Online (Sandbox Code Playgroud)