# @Date: 1970-01-01T08:00:00+08:00 # @Email: fm453@hiluker.com # @Last modified by: fm453 # @Last modified time: 2021-09-15T16:55:29+08:00 $params = array_merge( require(__DIR__ . '/../../common/config/params.php'), require(__DIR__ . '/params.php'), require(__DIR__ . '/citys.php'), require(__DIR__ . '/params-area.php'), require(__DIR__ . '/params-channel.php') ); $config = [ 'id' => 'app-backend', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\controllers', 'defaultRoute' => 'site', //默认路由 'bootstrap' => ['log'], 'modules' => [ "admin" => [ "class" => 'mdm\admin\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', ], /** * 语言包配置扩展(归于components下), * 将"源语言"翻译成"目标语言". 注意"源语言"默认配置为 'sourceLanguage' => 'en-US' * 使用: \Yii::t('common', 'title'); 将common/messages下的common.php中的title转为对应的中文 */ 'i18n' => [ 'translations' => [ 'common' => [ //有多套语言包要使用时,此处的*号可换成更具体的前缀,如pms 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@backend/lang', //'sourceLanguage' => 'en-US', 'fileMap' => [ 'common' => 'common.php', ], ], 'backend' => [ //有多套语言包要使用时,此处的*号可换成更具体的前缀,如pms 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@backend/lang', //'sourceLanguage' => 'en-US', 'fileMap' => [ 'backend' => 'backend.php', ], ], ], ], 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => true, 'suffix' => '.hi', //后缀 'rules' => [ ], ], ], 'params' => $params, ]; return $config;