Files
phalapi-pro/tests/config/dbs.php.sample
2022-03-21 11:16:38 +08:00

54 lines
2.1 KiB
Plaintext
Raw Permalink 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
/**
* 分库分表的自定义数据库路由配置
*
* @license http://www.phalapi.net/license GPL 协议
* @link http://www.phalapi.net/
* @author: dogstar <chanzonghuang@gmail.com> 2015-02-09
*/
return array(
/**
* DB数据库服务器集群
*/
'servers' => array(
'db_master' => array( //服务器标记
'host' => '127.0.0.1', //数据库域名
'name' => 'phalapi_pro_test', //数据库名字
'user' => 'dogstar', //数据库用户名
'password' => '123', //数据库密码
'port' => '3306', //数据库端口
'charset' => 'utf8mb4', //数据库字符集
'pdo_attr_string' => false, // 数据库查询结果统一使用字符串true是false否
'driver_options' => array( // PDO初始化时的连接选项配置
// 若需要更多配置请参考官方文档https://www.php.net/manual/zh/pdo.constants.php
),
),
),
/**
* 自定义路由表
*/
'tables' => array(
//通用路由
'__default__' => array(
'prefix' => 'pp_',
'key' => 'id',
'map' => array(
array('db' => 'db_master'),
),
),
/**
'demo' => array( //表名
'prefix' => '', //表名前缀
'key' => 'id', //表主键名
'map' => array( //表路由配置
array('db' => 'db_master'), //单表配置array('db' => 服务器标记)
array('start' => 0, 'end' => 2, 'db' => 'db_master'), //分表配置array('start' => 开始下标, 'end' => 结束下标, 'db' => 服务器标记)
),
),
*/
),
);