【发布时间】:2014-12-08 10:00:14
【问题描述】:
我想在 php 脚本中使用glob(),但我收到用户报告说服务器上并不总是允许这样做。一位用户报告了以下错误:
Warning: glob() has been disabled for security reasons
如何检测是否允许使用 glob?这是通过disable_functions 完成的,还是有其他方法可以禁用 glob? safe_mode 是否也禁用 glob? (php.net 上的一位评论者says so)。
除了检查 safe_mode 和 disable_functions 之外,还有其他方法可以可靠地检查它是否被允许(如:how to test if PHP system() function is allowed? and not turned off for security reasons 中所建议的)
【问题讨论】:
-
尝试执行它并捕获错误。
-
你试过了吗:
function_exists()?