<?php
return [
'id' => 'name',
'basePath' => dirname ( __DIR__ ),
'controllerNamespace' => 'path\path',
'bootstrap' => [ 'log', 'debug', 'gii' ],
'language' => 'zh-CN',
'modules' => [
//加载adminlte
// "admin" => [
// "class" => 'path\admin\Module',
// //'layout' => 'left-menu'
// ],
'gii' => [
'class' => 'yii\gii\Module',
],
'debug' => [
'class' => 'yii\debug\Module',
],
// 'redactor'=>'yii\redactor\RedactorModule',
],
// "aliases" => [
// "@mdm/admin" => "@vendor/mdmsoft/yii2-admin",
// ],
// 'as access' => [
// 'class' => 'path\admin\components\AccessControl',
// 'allowActions' => [ //这里是允许访问的action controller/action
// '*'// * 表示允许所有,后期会介绍这个
// ]
// ],
'components' => [
'formatter' => [
'dateFormat' => 'Y-m-d H:i:s',
],
//redis配置
'redis' => [
'class' => 'yii\redis\Connection',
// 'hostname' => 'localhost',
'hostname' => '192.168.1.1',
'port' => 6379,
'database' => 14,
// 'password' => 'password',
// 'auth' => 'XXXX',
],
// "authManager" => [
// "class" => 'yii\rbac\DbManager',
// ],
'request' => [
'csrfParam' => '_csrf-backend',
'cookieValidationKey' => 'XXXX',
'enableCookieValidation' => false,
'enableCsrfValidation' => false,
],
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
'identityCookie' => [ 'name' => '_identity-backend', 'httpOnly' => true ],
],
'session' => [
'name' => 'qn_flight_session',
],
//日志配置
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
'file' => [
'class' => 'yii\log\FileTarget',
'levels' => [ 'error', 'warning', 'info', 'trace' ],
'categories' => [ 'yii\*' ],
],
'provider' => [
'class' => 'yii\log\FileTarget',
'levels' => [ 'error', 'warning', 'info' ],
'categories' => [ 'provider' ],
'logFile' => '@app/runtime/logs/qn_provider.log.' . date ( "Ymd" ),
'logVars' => [ ],
'maxFileSize' => 1024 * 2000,
'maxLogFiles' => 20,
],
'pay' => [
'class' => 'yii\log\FileTarget',
'levels' => [ 'error', 'warning', 'info' ],
'categories' => [ 'pay' ],
'logVars' => [ ],
'logFile' => '@app/runtime/logs/XX.log.' . date ( "Ymd" ),
'maxFileSize' => 1024 * 2000,
'maxLogFiles' => 20,
],
'search' => [
'class' => 'yii\log\FileTarget',
'levels' => [ 'error', 'warning', 'info' ],
'categories' => [ 'search' ],
'logVars' => [ ],
'logFile' => '@app/runtime/logs/XX.log.' . date ( "Ymd" ),
'maxFileSize' => 1024 * 2000,
'maxLogFiles' => 20,
],
'email' => [
'class' => 'yii\log\EmailTarget',
'levels' => [ 'error', ],
'message' => [
'to' => [ 'XX@XX.com', 'lei.feng@XX.com' ],
'subject' => '来自qn_flight错误日志消息',
],
],
],
],
'errorHandler' => [
'errorAction' => 'site/error',
],
//路由优化
"urlManager" => [
//用于表明 urlManager 是否启用URL美化功能
"enablePrettyUrl" => true,
// 是否在URL中显示入口脚本
"showScriptName" => false,
],
//邮件配置
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,//这句一定有,false发送邮件,true只是生成邮件在runtime文件夹下,不发邮件
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.exmail.qq.com', //每种邮箱的host配置不一样
'username' => 'service@XX.com',
'password' => 'XXX', //授权码
'port' => '25',
'encryption' => 'tls',
],
'messageConfig' => [
'charset' => 'UTF-8',
'from' => [ 'service@feijipiao.co.nz' => 'XX.-沙箱' ],
],
],
'cache' => [
'class' => 'yii\caching\FileCache',
'cachePath' => '/export/share/cache/path',
],
],
'params' => $params,
];