当前位置:网站首页>TP configuring multiple databases
TP configuring multiple databases
2022-07-04 17:04:00 【wiscourper_】
1、 stay database.php Add
'db2' => [
// Database type
'type' => 'mysql',
// Server address
'hostname' => '127.0.0.1',
// Database name
'database' => 'test',
// user name
'username' => 'root',
// password
'password' => 'root',
// port
'hostport' => '3306',
// Connect dsn
'dsn' => '',
// Database connection parameters
'params' => [],
// The database encoding defaults to utf8
'charset' => 'utf8',
// Database table prefix
'prefix' => 'tn_',
// Database debugging mode
'debug' => true,
// Database deployment :0 Centralized ( Single server ),1 Distributed ( Master slave server )
'deploy' => 0,
// Is the database read-write separated Master slave is effective
'rw_separate' => false,
// After the separation of reading and writing Number of primary servers
'master_num' => 1,
// Specify the slave server serial number
'slave_no' => '',
// Automatically read the main database data
'read_master' => false,
// Whether to strictly check whether the field exists
'fields_strict' => true,
// Dataset return type
'resultset_type' => 'array',
// Auto write timestamp field
'auto_timestamp' => false,
// The default time format after the time field is taken out
'datetime_format' => 'Y-m-d H:i:s',
// Is it necessary to SQL Performance analysis
'sql_explain' => false,
]2、 The other set is the original one
3、 test
$db2 = \think\Db::connect(config('database.db2'));
$res = $db2->name("user")->find();
var_dump(\think\Db::table("customer")->find());// The original
var_dump($res);die;//db2 Of 边栏推荐
- ~88 running people practice
- 【Go ~ 0到1 】 第六天 文件的读写与创建
- 51 single chip microcomputer temperature alarm based on WiFi control
- NoSQL之readis配置与优化(终章)
- 话里话外:流程图绘制初级:六大常见错误
- 【云原生】服务网格是什么“格”?
- Go micro tutorial - Chapter 2 go micro V3 using gin and etcd
- 智慧物流园区供应链管理系统解决方案:数智化供应链赋能物流运输行业供应链新模式
- 中信证券网上开户安全吗 开户收费吗
- Capvision Rongying's prospectus in Hong Kong was "invalid": it was strictly questioned by the CSRC and required supplementary disclosure
猜你喜欢

嵌入式软件架构设计-函数调用

Start by counting

Learn more about the basic situation of 2022pmp examination

detectron2安装方法

Object.keys()的用法

leetcode:421. 数组中两个数的最大异或值

Understand ThreadLocal in one picture

S2b2b solution for lighting industry: efficiently enable the industrial supply chain and improve the economic benefits of enterprises

51 single chip microcomputer temperature alarm based on WiFi control
Why do you say that the maximum single table of MySQL database is 20million? Based on what?
随机推荐
Accounting regulations and professional ethics [7]
PyTorch深度学习快速入门教程
Research Report on market supply and demand and strategy of China's four sided flat bag industry
电子元器件B2B商城系统开发:赋能企业构建进销存标准化流程实例
Go language loop statement (under Lesson 10)
最大子数组与矩阵乘法
Hash table
程序员怎么才能提高代码编写速度?
【Go ~ 0到1 】 第六天 文件的读写与创建
Firebird experience summary
Yanwen logistics plans to be listed on Shenzhen Stock Exchange: it is mainly engaged in international express business, and its gross profit margin is far lower than the industry level
[acwing] 58 weeks 4490 dyeing
Congratulations to Mr. Zhang Pengfei, chief data scientist of artefact, for winning the campaign Asia tech MVP 2022
detectron2安装方法
2022年国内云管平台厂商哪家好?为什么?
Implement graph data construction task based on check point
Sql实现Split
[Acwing] 58周赛 4490. 染色
如何实现一个延时队列 ?
被PMP考试“折磨”出来的考试心得,值得你一览