From b84eba54c59e275305e52ad9456493520abb6677 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 9 Sep 2016 17:51:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BApp=E7=B1=BBbindParams?= =?UTF-8?q?=E6=96=B9=E6=B3=95=20=E6=94=AF=E6=8C=81=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E5=AE=9E=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/think/App.php b/library/think/App.php index 59df8ba8..bc741548 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -251,7 +251,11 @@ class App $class = $param->getClass(); if ($class) { $className = $class->getName(); - $args[] = method_exists($className, 'instance') ? $className::instance() : new $className(); + if (isset($vars[$name]) && $vars[$name] instanceof $className) { + $args[] = $vars[$name]; + } else { + $args[] = method_exists($className, 'instance') ? $className::instance() : new $className(); + } } elseif (1 == $type && !empty($vars)) { $args[] = array_shift($vars); } elseif (0 == $type && isset($vars[$name])) {