From b332e55dd27389de24fa2a544ec47a5f0d5f66da Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 27 Jul 2016 11:52:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Route=E7=B1=BBmatch=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E4=B8=80=E5=A4=84=E5=8F=98=E9=87=8F=E8=A7=A3=E6=9E=90?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index a3934496..6fd21090 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -340,9 +340,10 @@ class Route } else { if ($routes instanceof \Closure) { // 闭包注册 + $currentOption = self::$option; self::setOption($option); call_user_func_array($routes, []); - self::setOption([]); + self::setOption($currentOption); } else { // 批量注册路由 self::rule($routes, '', $type, $option, $pattern); @@ -1101,7 +1102,8 @@ class Route foreach ($m2 as $key => $val) { // val中定义了多个变量 if (false !== strpos($val, '<') && preg_match_all('/<(\w+(\??))>/', $val, $matches)) { - $value = []; + $value = []; + $replace = []; foreach ($matches[1] as $name) { if (strpos($name, '?')) { $name = substr($name, 0, -1);