From 7625aa9321a654ec2def6dc06ab9272999910e84 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 24 Dec 2016 20:23:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Url=E7=B1=BBbuild=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=AE=9A=E4=B9=89=E8=B7=AF=E7=94=B1=E5=88=AB=E5=90=8D?= =?UTF-8?q?=E5=90=8E=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Url.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/library/think/Url.php b/library/think/Url.php index d8730743..9ea900d8 100644 --- a/library/think/Url.php +++ b/library/think/Url.php @@ -89,7 +89,8 @@ class Url throw new \InvalidArgumentException('route name not exists:' . $name); } else { // 检查别名路由 - $alias = Route::rules('alias'); + $alias = Route::rules('alias'); + $matchAlias = false; if ($alias) { // 别名路由解析 foreach ($alias as $key => $val) { @@ -97,11 +98,13 @@ class Url $val = $val[0]; } if (0 === strpos($url, $val)) { - $url = $key . substr($url, strlen($val)); + $url = $key . substr($url, strlen($val)); + $matchAlias = true; break; } } - } else { + } + if (!$matchAlias) { // 路由标识不存在 直接解析 $url = self::parseUrl($url, $domain); }