在全局或者应用配置目录(不清楚配置目录位置的话参考配置章节)下面的/shop/configs/db.ini.php
中(后面统称为数据库配置文件)配置下面的数据库参数:
数据访问层
支持分布式数据库
,包括读写分离
,要启用分布式数据库,则配置多个数据库连接即可
支持多业务独立库
,例如这个系统可分为用户数据库
、支付数据库
、商品数据库
、订单数据库
、社交系统数据库
等等
<?php
$config_db['db_cfg'] = array(
'default' => 'mysql',
'master' => array(
'shop_data' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
),
'account' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
),
'pay' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
),
'shop_admin' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
),
'invoicing' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
),
'cms' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
),
'sns' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
),
'analytics' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
),
'live' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
)
),
'slave' => array(
'shop_base' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
),
'shop_data' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
),
'account' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
),
'pay' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
),
'shop_admin' => array(
array(
'host' => '127.0.0.1',
'port' => '3306',
'user' => 'store',
'password' => 'pswdfdaflk123213',
'database' => 'store_test',
'charset' => 'UTF8'
)
)
)
);
return $config_db;
文档更新时间: 2020-05-28 13:00 作者:随商信息技术(上海)有限公司