2011-11-18 50 views

回答

1

我假设你真的想检查是否函数存在,和PHP有一个,它调用function_exists()功能。

$exists = function_exists('some_function'); // Returns false, unless you defined that 
// To check if PHP-GD is installed, just check if a function 
// from that library exists. 
$gd = function_exists('imagepng'); 

这适用于PHP预定义的函数以及任何用户定义的函数。

+1

我很困惑,为什么这有一个downvote。目前我认为这是最好的答案。 –

+0

@Levi:我认为有人只是downvoted,因为有可能重复,我没有找到,因为我从审查页面来到这里。 -.- – animuson

+0

我想检查所有基本的PHP函数都支持server.How我可以检查一切吗? –