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' => [ ], ],

yii2模块化
文章图片
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'; }}

    推荐阅读