From 277e253e441c70fcf56ffdca755f504ee36abe83 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 20 May 2016 19:13:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Route=E7=B1=BB=E4=B8=80?= =?UTF-8?q?=E5=A4=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index 125d024b..2479cfd7 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -469,11 +469,15 @@ class Route if (!empty($val['routes'])) { // 分组路由 if ($pos = strpos($rule, ':')) { - $str = substr($rule, 0, $pos); + $str = substr($rule, 0, $pos); + $key1 = substr($rule, $pos) . '/'; } elseif ($pos = strpos($rule, '<')) { - $str = substr($rule, 0, $pos); + $str = substr($rule, 0, $pos); + $key1 = substr($rule, $pos) . '/'; } else { - $str = $rule; + $pos = strlen($rule) + 1; + $key1 = ''; + $str = $rule; } if (0 !== strpos($url, $str)) { continue; @@ -483,7 +487,9 @@ class Route if (is_numeric($key)) { $key = array_shift($route); } - $url1 = substr($url, strlen($rule) + 1); + $url1 = substr($url, $pos); + $key = $key1 . $key; + // 检查规则路由 if (is_array($route)) { $option1 = $route[1];