作者 CoolAbc

使用Thinkphp内置转换控制器名为c风格,匹配前台访问路径控制器是xxxx_xx的写法;thinkphp默认是将控制器dict_def转成dictDef,f…

…astadmin直接转成小写,造成权限失败.使用thinkphp内置的方法转换控制器名,与前台路径访问保持一致.
@@ -7,6 +7,7 @@ use think\Config; @@ -7,6 +7,7 @@ use think\Config;
7 use think\Controller; 7 use think\Controller;
8 use think\Hook; 8 use think\Hook;
9 use think\Lang; 9 use think\Lang;
  10 +use think\Loader;
10 use think\Session; 11 use think\Session;
11 use fast\Tree; 12 use fast\Tree;
12 13
@@ -114,7 +115,7 @@ class Backend extends Controller @@ -114,7 +115,7 @@ class Backend extends Controller
114 public function _initialize() 115 public function _initialize()
115 { 116 {
116 $modulename = $this->request->module(); 117 $modulename = $this->request->module();
117 - $controllername = strtolower($this->request->controller()); 118 + $controllername = Loader::parseName($this->request->controller());
118 $actionname = strtolower($this->request->action()); 119 $actionname = strtolower($this->request->action());
119 120
120 $path = str_replace('.', '/', $controllername) . '/' . $actionname; 121 $path = str_replace('.', '/', $controllername) . '/' . $actionname;