yii2添加module配置和常见问题解决
2017-09-26 22:49
435 查看
yii2开发的项目比较大,涉及到多个模块,可以使用module分开管理。
主要是以下几步:
1.在项目跟目录下手动创建modules目录
2.在modules创建各个模块名称,如:admin,...
3.在配置文件中,components中添加(一般是params.php或者web.php看使用的yii2版本有差异)
'modules' => [
'admin' => [
'class' => 'app\modules\admin\Module',
],
],
我只要配置,访问始终提示: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
主要是以下几步:
1.在项目跟目录下手动创建modules目录
2.在modules创建各个模块名称,如:admin,...
3.在配置文件中,components中添加(一般是params.php或者web.php看使用的yii2版本有差异)
'modules' => [
'admin' => [
'class' => 'app\modules\admin\Module',
],
],
我只要配置,访问始终提示: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
相关文章推荐
- Ubuntu上配置SVN,Apache服务以及常见问题解决方法
- windows 2008初体验常见问题: 无线网络"没有正确配置为使用IP协议" 错误解决办法
- Linux系统配置文件的详解和常见问题的解决
- 常见问题及解决办法 整理之7(添加远程服务器)
- phpmyadmin安装配置常见问题及解决办法
- Solaris 10 下 Samba 的详细配置步骤和常见问题解决
- Oracle tns配置的6种常见错误解决问题
- 思科***配置十大常见问题及其解决方法
- eclipse for java ee的tomcat配置(常见问题解决)
- IIS 配置问题 一些iis常见问题的解决方法
- Solaris 10 下 Samba 的详细配置步骤和常见问题解决
- spring 中配置log4j输出日志常见的一个小问题解决方法
- 配置Android开发环境常见错误解决办法(陆续添加)“your project contains error(s),please fix them before running your appli
- FCKEditor fckconfig.js配置,添加字体和大小 附:中文字体乱码问题解决
- windows 2008初体验常见问题: 无线网络"没有正确配置为使用IP协议" 错误解决办法
- 配置交换机常见3个问题及解决办法
- Android 开发配置常见问题解决
- IIS 配置问题 一些iis常见问题的解决方法
- OpenCV2.0在VS2010配置中出现问题的解决方法 VS2010 C++中出现常见问题:back_inserter
- lamp安装及常见问题解决(附配置文件)