路由到方法的时候 支持实例化类注入请求对象

This commit is contained in:
thinkphp
2016-09-22 10:33:34 +08:00
parent 4202fbc20b
commit b94b0a5118

View File

@@ -214,7 +214,7 @@ class App
public static function invokeMethod($method, $vars = []) public static function invokeMethod($method, $vars = [])
{ {
if (is_array($method)) { if (is_array($method)) {
$class = is_object($method[0]) ? $method[0] : new $method[0]; $class = is_object($method[0]) ? $method[0] : new $method[0](Request::instance());
$reflect = new \ReflectionMethod($class, $method[1]); $reflect = new \ReflectionMethod($class, $method[1]);
} else { } else {
// 静态方法 // 静态方法