From 3f654b6e5ef9516da17c414619dbf8bca1575b99 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 19 Oct 2016 11:22:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E8=87=AA=E5=8A=A8=E6=B3=A8?= =?UTF-8?q?=E5=85=A5=E6=9C=BA=E5=88=B6=20=E9=9C=80=E8=A6=81=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=E6=B3=A8=E5=85=A5=E7=9A=84=E7=B1=BB=E5=A6=82=E6=9E=9C?= =?UTF-8?q?=E5=AE=9A=E4=B9=89=E4=BA=86invoke=E6=96=B9=E6=B3=95=E5=88=99?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/App.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/think/App.php b/library/think/App.php index 67aac096..69833598 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -280,7 +280,14 @@ class App if ($bind instanceof $className) { $args[] = $bind; } else { - $args[] = method_exists($className, 'instance') ? $className::instance() : new $className(); + if (method_exists($className, 'invoke')) { + $method = new \ReflectionMethod($className, 'invoke'); + if ($method->isStatic()) { + $args[] = $className::invoke(); + continue; + } + } + $args[] = method_exists($className, 'instance') ? $className::instance() : new $className; } } elseif (1 == $type && !empty($vars)) { $args[] = array_shift($vars);