Files
23cm/config/web.php
2026-01-25 18:18:09 +08:00

97 lines
3.0 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
$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;