如果控制器名字为驼峰形式,目录名需要转为下划线

pull/8/head
pppscn 2018-08-27 10:52:09 +08:00
parent 1dfa8e80de
commit 88dfb8a277
1 changed files with 2 additions and 2 deletions

View File

@ -329,8 +329,8 @@ class Crud extends Command
$controllerUrl = strtolower(implode('/', $controllerArr));
$controllerBaseName = strtolower(implode(DS, $controllerArr));
//视图文件
$viewDir = $adminPath . 'view' . DS . $controllerBaseName . DS;
//视图文件 -- 如果控制器名字为驼峰形式,目录名需要转为下划线
$viewDir = $adminPath . 'view' . DS . strtolower(preg_replace('/(?<=[a-z])([A-Z])/', '_$1', implode(DS, $controllerArr))) . DS;
//最终将生成的文件路径
$javascriptFile = ROOT_PATH . 'public' . DS . 'assets' . DS . 'js' . DS . 'backend' . DS . $controllerBaseName . '.js';