yii2模块化
$params = require __DIR__ . '/params.php';
$db = require __DIR__ . '/db.php';
$modules = require __DIR__ .'/../modules/modules.php';
//文件引入
$config = [
'id' => 'basic',
'modules' => $modules,//检查modules名称有没有写错
'basePath' => dirname(__DIR__),
'vendorPath' => '/data/www/yii2-vendor',
'defaultRoute' => 'study/stock/emily-spoken-english',//resume/advantage/index,
...
//这一堆原来是注释的,要放出来
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
],
文章图片
image.png
modules.php的内容return [
'resume' => [
'class' => 'app\modules\resume\Module'
],
'study' => [
'class' => 'app\modules\study\Module'
]
];
Module.php的内容namespace app\modules\study;
class Module extends \yii\base\Module
{
public function init()
{
parent::init();
//$this->layout ='@app/modules/resume/layouts/main.php';
$this->viewPath = '@app/modules/study/views';
}}
推荐阅读
- 模块化演变,ESM基础知识、与Node.js,CMS关系
- ModStartCMS模块化万能建站系统v3.1.0 API接口支持,小程序上线
- ModStartCMS模块化万能建站系统v3.0.0|ModStartCMS模块化万能建站系统v3.0.0 会员VIP、访问控制、URL兼容
- Android模块化-----网络模块封装
- Android|Android应用TranslateAnimation移动之后,利用视图的setLayoutParams从新定位
- nginx 之cgi fastcgi.conf和fastcgi_params的区别
- Java9之后的模块化烦恼解决(由RocketMQ升级OpenJDK11想到的)
- Webpack|Webpack 原理-从前端模块化开始
- JavaScript|JavaScript 模块化详解
- Node模块加载及包