【发布时间】:2014-05-21 20:11:29
【问题描述】:
我想检查一个方法是否存在并且有参数。 这是一些sn-p。
// this only checks if the function exist or not
if(method_exists($controller, 'function_name'))
{
//do some stuff
}
但我想做的是
if(method_exists($controller, 'function_name(with_args)'))
{
}
【问题讨论】:
-
PHP 方法签名没有像其他语言那样严格定义。方法的签名中不能有任何已定义的参数,并且仍然接受参数。
标签: php