改进绑定到命名空间和类的判断 callable不存在的时候抛出异常

This commit is contained in:
thinkphp
2016-01-10 09:24:41 +08:00
parent 56cffea817
commit 09c6be5dd3
2 changed files with 9 additions and 5 deletions

View File

@@ -99,7 +99,11 @@ class App
break;
case 'callable':
// 执行回调方法
$data = call_user_func_array(self::$dispatch['callable'], self::$dispatch['params']);
if (is_callable(self::$dispatch['callable'])) {
$data = call_user_func_array(self::$dispatch['callable'], self::$dispatch['params']);
} else {
throw new Exception('not callable : ' . (is_array(self::$dispatch['callable']) ? implode('->', self::$dispatch['callable']) : self::$dispatch['callable']), 10009);
}
break;
case 'closure':
// 规则闭包