检查是否“执行"被禁用 [英] Check if "exec" is disabled

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

问题描述

PHP中是否可以使用任何函数来检测exec函数是否可用?

Is there any function in PHP that I can use to detect whether or not the exec function is available?

推荐答案

<?php
function exec_enabled() {
  $disabled = explode(',', ini_get('disable_functions'));
  return !in_array('exec', $disabled);
}
?>

根据Ziagl的评论修复了爆炸.

Fixed the explode as per Ziagl's comment.

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

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