1、打开/data/conf/config.php
‘db1‘=>[ // 数据库类型 ‘type‘ => ‘mysql‘, // 服务器地址 ‘hostname‘ => ‘‘, // 数据库名 ‘database‘ => ‘‘, // 用户名 ‘username‘ => ‘‘, // 密码 ‘password‘ => ‘‘, // 端口 ‘hostport‘ => ‘3306‘, // 数据库编码默认采用utf8 ‘charset‘ => ‘utf8mb4‘, // 数据库表前缀 ‘prefix‘ => ‘cmf_‘, "authcode" => ‘BadD4wbA22j1W2Y7vI‘, ]
2、在需要用到的地方调用
db(‘表名‘,‘db1‘)->select();
原文:https://www.cnblogs.com/dalaowang/p/11697446.html