From 731d0c0002665769e1ea15925174758b2d1dd6f3 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 2 Aug 2016 10:39:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= 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 cf019f44..bb23110a 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -211,7 +211,7 @@ class Route public static function rule($rule, $route = '', $type = '*', $option = [], $pattern = []) { $group = self::getGroup('name'); - if (!is_null($group)) { + if (!empty($group)) { // 路由分组 $option = array_merge(self::getGroup('option'), $option); $pattern = array_merge(self::getGroup('pattern'), $pattern); @@ -302,7 +302,7 @@ class Route if (isset(self::$group[$type])) { return self::$group[$type]; } else { - return null; + return 'name' == $type ? null : []; } } @@ -343,8 +343,8 @@ class Route } if (!empty($name)) { if ($routes instanceof \Closure) { - $currentOption = self::getGroup('option') ?: []; - $currentPattern = self::getGroup('pattern') ?: []; + $currentOption = self::getGroup('option'); + $currentPattern = self::getGroup('pattern'); self::setGroup($name, array_merge($currentOption, $option), array_merge($currentPattern, $pattern)); call_user_func_array($routes, []); self::setGroup($currentGroup, $currentOption, $currentPattern); @@ -383,8 +383,8 @@ class Route } elseif ($routes instanceof \Closure) { // 闭包注册 - $currentOption = self::getGroup('option') ?: []; - $currentPattern = self::getGroup('pattern') ?: []; + $currentOption = self::getGroup('option'); + $currentPattern = self::getGroup('pattern'); self::setGroup('', array_merge($currentOption, $option), array_merge($currentPattern, $pattern)); call_user_func_array($routes, []); self::setGroup($currentGroup, $currentOption, $currentPattern);