yii2添加module配置和常见问题解决
yii2开发的项目比较大,涉及到多个模块,可以使用module分开管理。
主要是以下几步:
1.在项目跟目录下手动创建modules目录
2.在modules创建各个模块名称,如:admin,...
3.在配置文件中,components中添加(一般是params.php或者web.php看使用的yii2版本有差异)
"modules" => [ "admin" => [ "class" => "appmodulesadminModule", ], ],
我只要配置,访问始终提示:The configuration for the "modules" component must contain a "class" element error错误,把modules配置移到components外面(具体原因也不是很清楚,假如读者知道,请赐教)
参考:https://stackoverflow.com/questions/34613648/the-configuration-for-the-modules-component-must-contain-a-class-element
4. 如要访问,moduels/admin/controllers/SiteController 里面的actionIndex。路径是/admin/site/index
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇: laravel 中获取执行的sql语句