From aada435e4b730ff035a8cd837f807e012ce51617 Mon Sep 17 00:00:00 2001 From: huangdijia Date: Fri, 4 Dec 2015 22:23:12 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A2=9D=E5=A4=96=E5=8F=82=E6=95=B0=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/route.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/library/think/route.php b/library/think/route.php index 22359b7e..de1712ba 100644 --- a/library/think/route.php +++ b/library/think/route.php @@ -446,18 +446,18 @@ class Route parse_str($url, $var); } if (isset($path)) { + $params = []; + if (!empty($path[3])) { + $params = explode('/', array_pop($path)); + } // 解析[模块/控制器/操作] $action = array_pop($path); $action = '[rest]' == $action ? REQUEST_METHOD : $action; $controller = !empty($path) ? array_pop($path) : null; $module = !empty($path) ? array_pop($path) : null; // 解析path额外的参数 - $param = []; - if (!empty($path)) { - $param = explode('/', array_pop($path)); - } - for ($i = 0; $i < count($param); $i++) { - $var[$param[$i]] = $param[++$i]; + for ($i = 0; $i < count($params); $i++) { + $var[$params[$i]] = $params[++$i]; } } return ['route' => [$module, $controller, $action], 'var' => $var];