diff --git a/app/functions.php b/app/functions.php index 18b52be..bfd4e4f 100644 --- a/app/functions.php +++ b/app/functions.php @@ -188,7 +188,8 @@ if (!function_exists('get_controller_path')) { $parts = explode('\\', $relative); $path = []; foreach ($parts as $p) { - $path[] = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $p)); + // 与 BuildAdmin admin_rule.name 一致:多段类名用 camelCase(如 auth/adminLog),不用 admin_log + $path[] = lcfirst($p); } return implode('/', $path); } @@ -215,10 +216,10 @@ if (!function_exists('get_controller_path')) { $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)); + $normalized[] = lcfirst($mod); + $normalized[] = lcfirst($ctrl); } else { - $normalized[] = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $seg)); + $normalized[] = lcfirst($seg); } } return implode('/', $normalized);