boaPHP开发手册v5.5

数据库配置

config.php

'DATABASE' => [
	//配置项
],

配置

配置项默认值类型说明
driverpdostring数据库驱动,可选值:pdo,mysqli
prefixstring表前缀
charsetutf8string数据库字符集,不要请置空
persistfalsebool是否持久连接
option[]array数据库选项,因驱动而异
typemysqlstring数据库类型,仅对pdo驱动有效
支持类型参见章节:数据库连接
hostlocalhoststring数据库主机
port3306int数据库端口
namestring数据库名称
usernullstring数据库用户
passnullstring数据库密码
master[]array主数据库(集),如设置此项,则表示开启读写分离主从模式,单例模式无需设置。
里面可以直接设置一组服务器信息,也可以设置多组服务器信息(二维数组)。
一组完整设置应该包含:type,charset,persist,option,host,port,name,user,pass字段,
省略的字段系统则使用上面相应的默认字段替代
slave[]array从数据库(集),含义同master
hashtype0int主从模式哈希计算方式,可选值:0=取模,1=随机