<code>'DB_TYPE'=>'mysql', //数据库类型 'DB_USER'=>'root', //用户名 'DB_PWD'=>'123456', //密码 'DB_PREFIX'=>'think_', //数据库表前缀 'DB_DSN'=>'mysql:host=localhost;dbname=thinkphp;charset=UTF8', //★★注意这里. </code>
If you write 'DB_DSN' like this, it will automatically use PDO to connect. If you don't write 'DB_DSN', it will be mysql connection?
Or do you still use Pdo to connect regardless of writing or not?
How to connect using other parameter settings?
<code>'DB_TYPE'=>'mysql', //数据库类型 'DB_USER'=>'root', //用户名 'DB_PWD'=>'123456', //密码 'DB_PREFIX'=>'think_', //数据库表前缀 'DB_DSN'=>'mysql:host=localhost;dbname=thinkphp;charset=UTF8', //★★注意这里. </code>
If you write 'DB_DSN' like this, it will automatically use PDO to connect. If you don't write 'DB_DSN', it will be mysql connection?
Or do you still use Pdo to connect regardless of writing or not?
How to connect using other parameter settings?
For versions below TP3.2.3, if DB_TYPE
uses the PDO
type, the database type is determined by the DB_DSN
configuration. Version 3.2.3 or above, DB_DSN
does not require setting, it is automatically set by the system. If it is version 3.2.3, since the PDO
method is all used, DB_TYPE
needs to be configured as the actual database type. It is no longer supported to be set to PDO
, and there is no distinction between mysql
and mysqli
. Reference document I hope it will be helpful to you