From 151224945484f1cd7608d1a001ec5cc8a7fb5198 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 1 Aug 2016 14:50:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E8=B7=AF=E7=94=B1=E5=88=86?= =?UTF-8?q?=E7=BB=84=E5=B5=8C=E5=A5=97=E4=BD=BF=E7=94=A8=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Route.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/library/think/Route.php b/library/think/Route.php index 24f6fb08..54f28844 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -333,12 +333,12 @@ class Route $option = $name; $name = isset($option['name']) ? $option['name'] : ''; } + // 分组 + $currentGroup = self::getGroup('name'); + if ($currentGroup) { + $name = $currentGroup . ($name ? '/' . ltrim($name, '/') : ''); + } if (!empty($name)) { - // 分组 - $currentGroup = self::getGroup('name'); - if ($currentGroup) { - $name = $currentGroup . '/' . ltrim($name, '/'); - } if ($routes instanceof \Closure) { $currentOption = self::getGroup('option'); $currentPattern = self::getGroup('pattern'); @@ -378,12 +378,8 @@ class Route } else { if ($routes instanceof \Closure) { // 闭包注册 - $currentGroup = self::getGroup('name'); $currentOption = self::getGroup('option'); $currentPattern = self::getGroup('pattern'); - if ($currentGroup) { - $name = $currentGroup . '/' . ltrim($name, '/'); - } self::setGroup($name, $option, $pattern); call_user_func_array($routes, []); self::setGroup($currentGroup, $currentOption, $currentPattern);