'app-backend', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\controllers', 'defaultRoute' => 'site', //默认路由 'bootstrap' => ['log'], 'modules' => [ "admin" => [ "class" => 'mdm\admin\Module', ], "data" => [ 'class' => 'vendor\fmsoft\modules\data\Module', //自动加载我的数据处理模型 ], ], 'aliases' => [ "@mdm/admin" => "@vendor/mdmsoft/yii2-admin", ], 'as access' => [ //加了才会自动验证是否有权限 'class' => 'mdm\admin\components\AccessControl', 'allowActions' => [ //允许访问的action //controller/action //'*', //开发环境配置完成后务必抹掉此项 'site/*', 'index/*' ] ], 'layout' => 'main',//布局文件 优先级: 控制器>配置文件>系统默认 'language' => 'zh-CN', //目标语言 //组件 'components' => [ 'request' => [ 'csrfParam' => '_csrf-backend', // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation 'cookieValidationKey' => 'CU5iSYmIp6kbjKKuh541KsA_oaYvTuNh', ], //身份认证类 'user' => [ 'identityClass' => 'backend\models\Adminer', 'enableAutoLogin' => true, 'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true], 'loginUrl' => ['site/login'], //配置登录url(可选项) ], 'session' => [ // this is the name of the session cookie used for login on the backend 'name' => 'advanced-backend', ], //Rbac权限控制 'authManager' => [ 'class' => 'yii\rbac\DbManager', 'itemTable' => 'auth_item', 'assignmentTable' => 'auth_assignment', 'itemChildTable' => 'auth_item_child', ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], ], ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => true, 'suffix' => '.hi', //后缀 'rules' => [ ], ], ], 'params' => $params ]; if (YII_ENV_DEV) { $config['bootstrap'][] = 'gii'; $config['modules']['gii'] = [ 'class' => 'yii\gii\Module', ]; } return $config;