canyin-project/ybcy/config/web - 副本.php
2024-11-01 16:07:54 +08:00

114 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
$info=file_get_contents('./web/cacheSet.log');
$passWord=json_decode($info,true)['redis']?:null;
$redisPort=json_decode($info,true)['redispx'];
$params = require __DIR__ . '/params.php';
$db = require __DIR__ . '/db.php';
$testAdomainArr = array(
'localhost' ,
'www.ybqk.local:60' ,
's883i38834.vicp.fun' ,
);
//define('IS_TEST', isset($testAdomainArr[$_SERVER['HTTP_HOST']]) ? 1 : 0); //测试环境标志1为是0为否
define('IS_TEST', (strpos($_SERVER['HTTP_HOST'], 'vicp.fun') === FALSE) ? 0 : 1 ? 1 : 0); //测试环境标志1为是0为否
if (IS_TEST)
{
//测试环境开启开发者模式,用于debug调试
define('YII_DEBUG', TRUE);
}
$config = [
'defaultRoute' => 'admin/login/index',
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['queue'],
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'components' => [
'timeZone'=>'PRC',
'session'=>array(
'timeout'=>10800,
),
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => 'true',
'enableCsrfValidation' => false,
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'user' => [
'identityClass' => 'app\models\User',
'enableAutoLogin' => true,
],
'errorHandler' => [
'errorAction' => 'site/error',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
// send all mails to a file by default. You have to set
// 'useFileTransport' to false and configure a transport
// for the mailer to send real emails.
'useFileTransport' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning','info'],
//表示以yii\db\或者app\models\开头的分类都会写入这个文件
'categories'=>['yii\db\*','app\models\*'],
//表示写入到文件Y
'logFile'=>'@runtime/logs/sql_'.date('Y_m_d').'.log',
],
],
],
'redis' => [
'class' => 'yii\redis\Connection',
'hostname' => '127.0.0.1',
'port' => $redisPort,
'database' => 0,
'password'=>$passWord
],
'db' => $db,
'queue' => [
'class' => \yii\queue\file\Queue::class,
'as log' => \yii\queue\LogBehavior::class,//错误日志 默认为 console/runtime/logs/app.log
'path' => '@runtime/queue',
],
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
],
],
],
'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;