From 0ad3e4587a48591b1751a5fa5791154fd1d8f851 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 25 Mar 2016 17:03:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E8=B7=AF=E7=94=B1=E8=A7=84?= =?UTF-8?q?=E5=88=99=E5=AE=9A=E4=B9=89=E7=9A=84=E5=8F=98=E9=87=8F=E8=8E=B7?= =?UTF-8?q?=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index 0db27162..10a96214 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -609,10 +609,18 @@ class Route $val = str_replace('<' . $name . '>', '(' . $pattern[$name] . ')', $val); } } - if (!preg_match('/^' . $val . '$/', $m1[$key])) { + if (preg_match('/^' . $val . '$/', $m1[$key], $match)) { + array_shift($match); + foreach ($matches[1] as $i => $name) { + if (strpos($name, '?')) { + $name = substr($name, 0, -1); + } + $var[$name] = $match[$i]; + } + continue; + } else { return false; } - continue; } if (0 === strpos($val, '[:')) {