From 32484b3bd759817afb5a9404c94f03952f5006be Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 9 Sep 2016 19:43:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BApp=E7=B1=BBbindParams?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/library/think/App.php b/library/think/App.php index d574e647..20c671fc 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -213,10 +213,6 @@ class App */ public static function invokeMethod($method, $vars = []) { - if (empty($vars)) { - // 自动获取请求变量 - $vars = Request::instance()->param(); - } if (is_array($method)) { $class = is_object($method[0]) ? $method[0] : new $method[0]; $reflect = new \ReflectionMethod($class, $method[1]); @@ -237,8 +233,12 @@ class App * @param array $vars 变量 * @return array */ - private static function bindParams($reflect, $vars) + private static function bindParams($reflect, $vars = []) { + if (empty($vars)) { + // 自动获取请求变量 + $vars = Request::instance()->param(); + } $args = []; // 判断数组类型 数字数组时按顺序绑定参数 reset($vars);