From b5b5390832e7c509c8af2aa81c0fdfec3a0f5c33 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 22 Oct 2016 20:24:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=BB=91=E5=AE=9A=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E6=83=85=E5=86=B5=E4=B8=8B=20=E8=B7=AF=E7=94=B1?= =?UTF-8?q?=E6=A0=87=E8=AF=86=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/think/Route.php b/library/think/Route.php index df1b62b9..c07bf5e5 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -1203,7 +1203,14 @@ class Route self::parseUrlParams(empty($path) ? '' : implode('|', $path)); // 封装路由 $route = [$module, $controller, $action]; - if (isset(self::$rules['name'][strtolower($module . '/' . Loader::parseName($controller, 1) . '/' . $action)])) { + // 检查地址是否被定义过路由 + $name = strtolower($module . '/' . Loader::parseName($controller, 1) . '/' . $action); + $name2 = ''; + if (isset(self::$bind['module']) && $module == self::$bind['module']) { + $name2 = strtolower(Loader::parseName($controller, 1) . '/' . $action); + } + + if (isset(self::$rules['name'][$name]) || isset(self::$rules['name'][$name2])) { throw new HttpException(404, 'invalid request:' . str_replace('|', $depr, $url)); } }