From a76d656110a99dafd3fdf62c71371f28ab12a3b5 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 23 Apr 2018 18:19:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9Burl=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=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/App.php | 6 +++++- library/think/Route.php | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/library/think/App.php b/library/think/App.php index 4ef580fc..3c5f81f0 100644 --- a/library/think/App.php +++ b/library/think/App.php @@ -555,7 +555,11 @@ class App // 获取操作名 $actionName = strip_tags($result[2] ?: $config['default_action']); - $actionName = $convert ? strtolower($actionName) : $actionName; + if (!empty($config['action_convert'])) { + $actionName = Loader::parseName($actionName, 1); + } else { + $actionName = $convert ? strtolower($actionName) : $actionName; + } // 设置当前请求的控制器、操作 $request->controller(Loader::parseName($controller, 1))->action($actionName); diff --git a/library/think/Route.php b/library/think/Route.php index 2dbd61dd..ac7718b1 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -1506,7 +1506,7 @@ class Route App::$modulePath = APP_PATH . (Config::get('app_multi_module') ? $request->module() . DS : ''); } else { // 路由到模块/控制器/操作 - $result = self::parseModule($route); + $result = self::parseModule($route, isset($option['convert']) ? $option['convert'] : false); } // 开启请求缓存 if ($request->isGet() && isset($option['cache'])) { @@ -1529,7 +1529,7 @@ class Route * @param string $url URL地址 * @return array */ - private static function parseModule($url) + private static function parseModule($url, $convert = false) { list($path, $var) = self::parseUrlPath($url); $action = array_pop($path); @@ -1543,7 +1543,7 @@ class Route // 设置当前请求的路由变量 Request::instance()->route($var); // 路由到模块/控制器/操作 - return ['type' => 'module', 'module' => [$module, $controller, $action], 'convert' => false]; + return ['type' => 'module', 'module' => [$module, $controller, $action], 'convert' => $convert]; } /**