【发布时间】:2012-03-08 12:00:01
【问题描述】:
我正在尝试检查一个函数是否存在,但我的 if 总是出错
我尝试这样调用函数,其中$function是函数名:
if (function_exists($this->module->$function))
{
$this->module->$function($vars);
}
else
{
echo 'no';
}
变量module被定义为函数应该被调用的类:
$this->module = $module;
$this->module = new $this -> module;
我在这里遗漏了什么吗? 谢谢!
【问题讨论】: