Compare commits
1 Commits
c602c0d67d
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b039b7abe |
@@ -204,7 +204,24 @@ if (!function_exists('get_controller_path')) {
|
|||||||
if (count($parts) < 2) {
|
if (count($parts) < 2) {
|
||||||
return $parts[0] ?? null;
|
return $parts[0] ?? null;
|
||||||
}
|
}
|
||||||
return implode('/', array_slice($parts, 1, -1)) ?: $parts[1];
|
$segments = array_slice($parts, 1, -1);
|
||||||
|
if ($segments === []) {
|
||||||
|
return $parts[1] ?? null;
|
||||||
|
}
|
||||||
|
// ThinkPHP 风格段 game.Config -> game/config,与 $request->controller 解析结果一致(否则权限节点对不上)
|
||||||
|
$normalized = [];
|
||||||
|
foreach ($segments as $seg) {
|
||||||
|
if (str_contains($seg, '.')) {
|
||||||
|
$dotPos = strpos($seg, '.');
|
||||||
|
$mod = substr($seg, 0, $dotPos);
|
||||||
|
$ctrl = substr($seg, $dotPos + 1);
|
||||||
|
$normalized[] = strtolower($mod);
|
||||||
|
$normalized[] = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $ctrl));
|
||||||
|
} else {
|
||||||
|
$normalized[] = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $seg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return implode('/', $normalized);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user