From 17a78925ee8025ea72edc067d5d4544007d97280 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 22 Feb 2016 20:22:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3Url=E7=B1=BB=E5=AF=B9?= =?UTF-8?q?=E9=A9=BC=E5=B3=B0=E6=8E=A7=E5=88=B6=E5=99=A8=E5=90=8D=E7=9A=84?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Url.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/library/think/Url.php b/library/think/Url.php index 982272f2..08070e6e 100644 --- a/library/think/Url.php +++ b/library/think/Url.php @@ -129,11 +129,11 @@ class Url // 空字符串输出当前的 模块/控制器/操作 $url = $module . CONTROLLER_NAME . '/' . ACTION_NAME; } else { - $path = explode('/', $url); - $len = count($path); - if ($len < 3) { - $url = $module . (1 == $len ? CONTROLLER_NAME . '/' : '') . $url; - } + $path = explode('/', $url); + $action = array_pop($path); + $controller = empty($path) ? CONTROLLER_NAME : (Config::get('url_controller_convert') ? Loader::parseName(array_pop($path)) : array_pop($path)); + $module = empty($path) ? $module : array_pop($path); + $url = ($module ? $module . '/' : '') . $controller . '/' . $action; } } return $url;