mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进url操作方法的自动转换
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user