97 lines
3.0 KiB
PHP
97 lines
3.0 KiB
PHP
<?php
|
||
|
||
$params = require __DIR__ . '/params.php';
|
||
$db = require __DIR__ . '/db.php';
|
||
|
||
$config = [
|
||
'id' => 'basic',
|
||
'basePath' => dirname(__DIR__),
|
||
'bootstrap' => ['log'],
|
||
'aliases' => [
|
||
'@bower' => '@vendor/yidas/yii2-bower-asset/bower',
|
||
'@npm' => '@vendor/npm-asset',
|
||
],
|
||
'timeZone' => 'Asia/Shanghai',
|
||
'components' => [
|
||
'assetManager' => [
|
||
// 'bundles' => [
|
||
// 'yii\web\JqueryAsset' => [
|
||
// 'basePath' => '@webroot',
|
||
// 'baseUrl' => '@web',
|
||
// 'js' => [
|
||
// 'js/jquery.js', // 你的 jQuery
|
||
// ],
|
||
// ],
|
||
// ],
|
||
],
|
||
'request' => [
|
||
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
|
||
'cookieValidationKey' => '0VfdiVtgFI4CJ4PNusreE5khkMp8fna2',
|
||
],
|
||
'cache' => [
|
||
'class' => 'yii\caching\FileCache',
|
||
],
|
||
'oceanengine' => [
|
||
'class' => 'app\components\Oceanengine',
|
||
],
|
||
'user' => [
|
||
'identityClass' => 'app\models\User',
|
||
'enableAutoLogin' => true,
|
||
],
|
||
'redis' => [
|
||
'class' => 'yii\redis\Connection',
|
||
'hostname' => 'localhost',
|
||
'port' => 6379,
|
||
'database' => 0,
|
||
],
|
||
'errorHandler' => [
|
||
'errorAction' => 'site/error',
|
||
],
|
||
'mailer' => [
|
||
'class' => \yii\symfonymailer\Mailer::class,
|
||
'viewPath' => '@app/mail',
|
||
// send all mails to a file by default.
|
||
'useFileTransport' => true,
|
||
],
|
||
'log' => [
|
||
'traceLevel' => YII_DEBUG ? 3 : 0,
|
||
'targets' => [
|
||
[
|
||
'class' => 'yii\log\FileTarget',
|
||
'levels' => ['error', 'warning'],
|
||
],
|
||
],
|
||
],
|
||
'db' => $db,
|
||
'urlManager' => [
|
||
'enablePrettyUrl' => true,
|
||
'showScriptName' => false,
|
||
'rules' => [
|
||
// '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', // 带 ID
|
||
'<action:\w+>' => 'site/<action>', // site 控制器下的简单 action,例如 login, logout, console
|
||
'' => 'site/index', // 首页
|
||
],
|
||
],
|
||
],
|
||
'params' => $params,
|
||
];
|
||
|
||
if (YII_ENV_DEV) {
|
||
// configuration adjustments for 'dev' environment
|
||
// $config['bootstrap'][] = 'debug';
|
||
// $config['modules']['debug'] = [
|
||
// 'class' => 'yii\debug\Module',
|
||
// // uncomment the following to add your IP if you are not connecting from localhost.
|
||
// //'allowedIPs' => ['127.0.0.1', '::1'],
|
||
// ];
|
||
|
||
$config['bootstrap'][] = 'gii';
|
||
$config['modules']['gii'] = [
|
||
'class' => 'yii\gii\Module',
|
||
// uncomment the following to add your IP if you are not connecting from localhost.
|
||
//'allowedIPs' => ['127.0.0.1', '::1'],
|
||
];
|
||
}
|
||
|
||
return $config;
|