From 367242113dd43c99bd724f6f29ed2892ee6bb205 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Fri, 21 Oct 2016 12:02:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E6=8E=A7=E5=88=B6=E5=99=A8?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=90=9C=E7=B4=A2=E5=90=8E=E7=9A=84=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E5=99=A8=E5=90=8D=E8=8E=B7=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index 660b8d32..d045ec95 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -1176,15 +1176,22 @@ class Route $dir = APP_PATH . ($module ? $module . DS : '') . Config::get('url_controller_layer'); $suffix = App::$suffix || Config::get('controller_suffix') ? ucfirst(Config::get('url_controller_layer')) : ''; $item = []; + $find = false; foreach ($path as $val) { - $item[] = array_shift($path); - if (is_file($dir . DS . $val . $suffix . EXT)) { + $item[] = $val; + if (is_file($dir . DS . str_replace('.', DS, $val) . $suffix . EXT)) { + $find = true; break; } else { $dir .= DS . $val; } } - $controller = implode('.', $item); + if ($find) { + $controller = implode('.', $item); + $path = array_slice($path, count($item)); + } else { + $controller = array_shift($path); + } } else { // 解析控制器 $controller = !empty($path) ? array_shift($path) : null;