2026-05-29 19:54:56 +08:00

121 lines
3.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
use common\services\ClientMessageServices;
use common\services\RedisService;
$baseurl = dirname(__DIR__);
Yii::setAlias('@common', $baseurl . "/../common");
Yii::setAlias('@bower', dirname(dirname(__DIR__)) . '/common/vendor/bower');
Yii::setAlias('@npm', dirname(dirname(__DIR__)) . '/common/vendor/npm');
$config = [
'id' => 'home',
'basePath' => dirname(__DIR__),
'bootstrap' => [
'log', 'clientMessage'
],
'vendorPath' => "@common/vendor",
'defaultRoute' => 'site/index',//默认控制器
'timeZone' => 'Asia/Shanghai',
'components' => [
'request' => [
'cookieValidationKey' => 'testas',
'enableCsrfValidation' => false //跨域提交问题
],
'user' => [
'identityClass' => '',
'enableAutoLogin' => false
],
'cache' => [
'class' => 'yii\caching\FileCache'
],
'errorHandler' => [
'errorAction' => 'error/index'
],
/*'assetManager'=>[
'bundles' => [
'yii\bootstrap\BootstrapAsset' => [
'css' => []
],
'yii\web\JqueryAsset' => [
'sourcePath' => null,
'js' => []
],
]
],*/
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => [
'error',
'warning'
],
'exportInterval' => 0,
'logVars' => [],
]
],
'flushInterval' => 0,
],
'db' => require(__DIR__ . '/../../common/config/db.php'),
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,//这句一定有false发送邮件true只是生成邮件在runtime文件夹下不发邮件
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.126.com', //每种邮箱的host配置不一样
'username' => 'test@test.com',
'password' => 'pwd',
'port' => '25',
//'encryption' => 'tls',
],
'messageConfig' => [
'charset' => 'UTF-8',
'from' => ['test@test.com' => 'test']
],
],
'urlManager' => [
'enablePrettyUrl' => false,
'showScriptName' => false,
'rules' => [
]
],
'redis' => [
'class' => 'common\utils\MyRedisClient',
],
'clientMessage' => [
'class' => ClientMessageServices::className(),
],
'easywechat' => [
'class' => 'common\utils\EasyWeChatApplication',
],
],
'params' => require(__DIR__ . '/../../common/config/params.php'),
'as beforeRequest' => [
'class' => 'yii\filters\Cors',
],
// 'as beforeRequest' => [
// 'class' => 'common\services\ClientMessageFilter',
// ]
];
if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
/* $config['bootstrap'][] = 'debug';
$config['modules']['debug'] = [
'class' => 'yii\debug\Module'
];
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module'
];*/
}
return $config;