yii2 config
来源:互联网 发布:2016中日贸易数据 编辑:程序博客网 时间:2024/06/04 19:25
1、语言设置
return [ 'aliases' => [ '@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset', ], 'vendorPath' => dirname(dirname(__DIR__)) . '/vendor', 'components' => [ 'cache' => [ 'class' => 'yii\caching\FileCache', ], ], 'language' => 'zh-CN',//这里是重点 common/config/main.php];
2、yii2底部debug
if (!YII_ENV_TEST) { //backend/config/main-local.php 这里是右下角debug和gii // 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', ];}
3、配置URL规则
'urlManager' => [ 'enablePrettyUrl' => true, 'rules' => [ 'home' => 'test/index', '<alias:about>' => 'test/page', 'page/<alias>' => 'test/page', ] ],
4、缓存(memcache、redis、fileCache等缓存)
'components' => [ 'cache' => [ 'class' => 'yii\caching\MemCache', //memcached 'servers' => [ [ 'host' => 'server1', 'port' => 11211, 'weight' => 100, ], [ 'host' => 'server2', 'port' => 11211, 'weight' => 50, ], ], ], ],
----------------------------------------------------
'components' => [ 'redis' => [ 'class' => 'yii\redis\Connection', 'hostname' => '127.0.0.1', 'port' => 6379, 'database' => 0, 'password'=>'password' ], 'cache' => [ 'class' => 'yii\redis\Cache', //redis 'keyPrefix' => 'redis_01_key', ], ],
5、session
'session' => [ 'class' => 'yii\redis\Session', 'keyPrefix' => 'session_key', ],
阅读全文
0 0
- yii2 config
- yii2 mail config
- YII2
- YII2
- Yii2
- yii2
- Yii2
- Yii2.0config配置目录下的web.php 学习笔记
- Config
- .config
- config
- Config
- config
- config
- config
- config
- Config
- Config
- 【LeetCode】40.Combination Sum II(Medium)解题报告
- ggplot2-条形图和折线图(转载)
- IT的道德与伦理
- RecyclerView多布局
- Insert Interval:在区间数组中插入新的区间
- yii2 config
- ViewPager切换动画
- VMware Workstation 14永久激活密钥
- AngularJs购物车删除和计算总金额
- Windows 关机命令
- WPF绘制3D动画效果
- C#进程间通信,传递消息给其它窗口
- <转载>eclipse 配置黑色主题
- 安卓手把手教你学习并实现 安卓耳机口音频转红外发射