database.php 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. // +----------------------------------------------------------------------
  12. // | ThinkPHP [ WE CAN DO IT JUST THINK ]
  13. // +----------------------------------------------------------------------
  14. // | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
  15. // +----------------------------------------------------------------------
  16. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  17. // +----------------------------------------------------------------------
  18. // | Author: liu21st <liu21st@gmail.com>
  19. // +----------------------------------------------------------------------
  20. use think\facade\Env;
  21. return [
  22. // 默认使用的数据库连接配置
  23. 'default' => Env::get('database.driver', 'mysql'),
  24. // 数据库连接配置信息
  25. 'connections' => [
  26. 'mysql' => [
  27. // 数据库类型
  28. 'type' => Env::get('database.type', 'mysql'),
  29. // 服务器地址
  30. 'hostname' => Env::get('database.hostname', '127.0.0.1'),
  31. // 数据库名
  32. 'database' => Env::get('database.database', 'crmeb31'),
  33. // 用户名
  34. 'username' => Env::get('database.username', 'root'),
  35. // 密码
  36. 'password' => Env::get('database.password', 'root'),
  37. // 端口
  38. 'hostport' => Env::get('database.hostport', '3306'),
  39. // 连接dsn
  40. 'dsn' => '',
  41. // 数据库连接参数
  42. 'params' => [],
  43. // 数据库编码默认采用utf8
  44. 'charset' => Env::get('database.charset', 'utf8'),
  45. // 数据库表前缀
  46. 'prefix' => Env::get('database.prefix', 'eb_'),
  47. // 数据库调试模式
  48. 'debug' => Env::get('database.debug', true),
  49. // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
  50. 'deploy' => 0,
  51. // 数据库读写是否分离 主从式有效
  52. 'rw_separate' => false,
  53. // 读写分离后 主服务器数量
  54. 'master_num' => 1,
  55. // 指定从服务器序号
  56. 'slave_no' => '',
  57. // 是否严格检查字段是否存在
  58. 'fields_strict' => true,
  59. // 是否需要进行SQL性能分析
  60. 'sql_explain' => false,
  61. // Builder类
  62. 'builder' => '',
  63. // Query类
  64. 'query' => '',
  65. // 是否需要断线重连
  66. 'break_reconnect' => true,
  67. ],
  68. // 更多的数据库配置信息
  69. ],
  70. // 自定义时间查询规则
  71. 'time_query_rule' => [],
  72. // 自动写入时间戳字段
  73. 'auto_timestamp' => 'timestamp',
  74. // 时间字段取出后的默认时间格式
  75. 'datetime_format' => 'Y-m-d H:i:s',
  76. //数据分页配置
  77. 'page' => [
  78. //页码key
  79. 'pageKey' => 'page',
  80. //每页截取key
  81. 'limitKey' => 'limit',
  82. //每页截取最大值
  83. 'limitMax' => 100,
  84. //默认条数
  85. 'defaultLimit' => 10,
  86. ]
  87. ];