'app-backend', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\controllers', 'bootstrap' => ['log'], 'modules' => [], 'on beforeRequest' => function($event) { \yii\base\Event::on(\yii\db\BaseActiveRecord::className(), \yii\db\BaseActiveRecord::EVENT_AFTER_UPDATE, ['common\models\AdminLog', 'afterUpdate']); \yii\base\Event::on(\yii\db\BaseActiveRecord::className(), \yii\db\BaseActiveRecord::EVENT_AFTER_INSERT, ['common\models\AdminLog', 'afterInsert']); \yii\base\Event::on(\yii\db\BaseActiveRecord::className(), \yii\db\BaseActiveRecord::EVENT_AFTER_DELETE, ['common\models\AdminLog', 'afterDels']); }, 'components' => [ 'request' => [ 'csrfParam' => 'token', ], // 'cache'=>[ // 'class'=>'yii\caching\FileCache', // 'cachePath'=>'@runtime/../cachefile/', // // ], // 'user' => [ // 'identityClass' => 'common\models\User', // 'enableAutoLogin' => true, // 'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true], // ], // 'pfg'=>[ // 'class' => 'backend\base\ToJson', // ], 'mailer' => [ //邮箱设置 'class' => 'yii\swiftmailer\Mailer', 'useFileTransport' =>false,//这句一定有,false发送邮件,true只是生成邮件在runtime文件夹下,不发邮件 'transport' => $emailConfig, 'messageConfig'=>[ 'charset'=>'UTF-8', 'from'=>[$emailConfig['username']=>'报名资料'.time()] ], ], 'session' => [ // this is the name of the session cookie used for login on the backend 'name' => 'advanced-backend', ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning'], ], // [ // 'class' => 'yii\log\FileTarget', // 'levels' => ['error', 'warning','info'], // 'logVars'=>[], // //表示以yii\db\或者app\models\开头的分类都会写入这个文件 // 'categories'=>['yii\db\*','common\models\*'], // //表示写入到文件sql.log中年月日记录日志 // 'logFile'=>'@runtime/../logs/sql/sql.log'.date('Ymd'), // ] ], ], 'errorHandler' => [ 'errorAction' => 'site/error', ], 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, // 'suffix'=>'', 'rules' => [ '/'=>'index/index', '/.html'=>'/', '/.php'=>'/', ], ], 'assetManager' => [ // 'class' => 'yii\web\AssetManager', // 'appendTimestamp' => true, // 'forceCopy' => true, 'bundles' => [ 'linkAssets' => true, 'yii\web\YiiAsset' => [ 'js' => [], // 去除 yii.js 'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件 ], 'yii\widgets\ActiveFormAsset' => [ 'js' => [], // 去除 yii.activeForm.js 'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件 ], 'yii\validators\ValidationAsset' => [ 'js' => [], // 去除 yii.validation.js 'sourcePath' => null, // 防止在 frontend/web/asset 下生产文件 ], ], ], 'i18n' => [ 'translations' => [ 'app*' => [ 'class' => 'yii\i18n\PhpMessageSource', 'basePath' => '@common/messages', // 'sourceLanguage' => 'en', 'fileMap' => [ 'app' => 'app.php', // 'app/error' => 'error.php', ], ], // 'model*' => [ // 'class' => 'yii\i18n\PhpMessageSource', // 'basePath' => '@common/messages', // 'fileMap' => [ // 'model' => 'model.php' // ] // ] ], ], ], 'params' => $params, 'language' =>'zh-CN', ];