main-local.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. return [
  3. 'components' => [
  4. // Mysql部分的配置
  5. 'db' => [
  6. 'class' => 'yii\db\Connection',
  7. 'dsn' => 'mysql:host=127.0.0.1;dbname=fecshop',
  8. 'username' => 'root',
  9. 'password' => 'xxxxxx',
  10. 'charset' => 'utf8',
  11. ],
  12. // Mongodb部分的配置
  13. 'mongodb' => [
  14. 'class' => 'yii\mongodb\Connection',
  15. # 有账户的配置
  16. //'dsn' => 'mongodb://username:password@localhost:27017/datebase',
  17. # 无账户的配置
  18. 'dsn' => 'mongodb://127.0.0.1:27017/fecshop',
  19. # 复制集
  20. //'dsn' => 'mongodb://10.10.10.252:10001/erp,mongodb://10.10.10.252:10002/erp,mongodb://10.10.10.252:10004/erp?replicaSet=terry&readPreference=primaryPreferred',
  21. ],
  22. // Redis的配置
  23. 'redis' => [
  24. 'class' => 'yii\redis\Connection',
  25. 'hostname' => '127.0.0.1', // redis的host
  26. 'port' => 6379, // redis的端口
  27. //'password' => 'xxxxx', // redis的密码
  28. 'database' => 0, // redis的库,此处不要改动
  29. ],
  30. // Cache 组件的配置,您需要配置下面的redis
  31. 'cache' => [
  32. 'class' => 'yii\redis\Cache',
  33. // 缓存配置独立的redis,您可以和上面的redis配置一致
  34. 'redis' => [
  35. 'hostname' => '127.0.0.1', // redis的host
  36. 'port' => 6379, // redis的端口
  37. //'password' => 'xxxxx', // redis的密码
  38. ],
  39. ],
  40. // Session 组件的配置,您需要配置下面的redis
  41. 'session' => [
  42. 'class' => 'yii\redis\Session',
  43. // session过期时间,1天过期
  44. 'timeout' => 86400 * 1,
  45. // 缓存配置独立的redis,您可以和上面的redis配置一致
  46. 'redis' => [
  47. 'hostname' => '127.0.0.1', // redis的host
  48. 'port' => 6379, // redis的端口
  49. //'password' => 'xxxxx', // redis的密码
  50. ],
  51. ],
  52. ],
  53. ];