Thinkphp5- database type is not defined

After the code tracking and print verification, the question is: config passed value is a string, so the resolution is empty when $ config parse out the default database configuration.

 

 

 

 Solution: the configuration file used to configure an array of ways

//数据库配置1
'db_config1' => [ // 数据库类型 'type' => 'mysql', // 服务器地址 'hostname' => '127.0.0.1', // 数据库名 'database' => 'thinkphp', // 数据库用户名 'username' => 'root', // 数据库密码 'password' => '', // 数据库编码默认采用utf8 'charset' => 'utf8', // 数据库表前缀 'prefix' => 'think_', ],

Guess you like

Origin www.cnblogs.com/peteremperor/p/12132917.html