/** * 自定义初始化组件方法 * @throws InvalidConfigException */ private function _init() { if (!static::$mobCompenent instanceof \common\compenents\MobileCode) { //注册mob组件 $_conf = ['class' => \common\compenents\MobileCode::className()]; $_conf = array_merge($_conf, \common\helpers\CommonHelper::loadConfig('mobConf')); static::$mobCompenent = \yii::createObject($_conf); } }
<?php return ['id' => 'app-backend', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\\controllers', 'bootstrap' => ['log'], 'language' => 'zh_cn', 'modules' => [], 'components' => ['user' => ['identityClass' => 'common\\models\\User', 'enableAutoLogin' => true], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'urlManager' => ['enablePrettyUrl' => true, 'showScriptName' => false], 'request' => ['class' => 'common\\compenents\\Request'], 'errorHandler' => ['errorAction' => 'site/error'], 'config' => ['ConfigPaths' => ['@backend']]], 'params' => \common\helpers\CommonHelper::loadConfig('params')];