Home >Backend Development >PHP Tutorial >Thinkphp's mysql database connection problem?

Thinkphp's mysql database connection problem?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-08-04 09:20:271219browse

What is the difference between configuring the database in tp using the default configuration file and using pdo?

Reply content:

What is the difference between configuring the database in tp using the default configuration file and using pdo?

The bottom layer of the framework must still use pdo. The configuration file is given just for your convenience

The framework layer will be reassembled into the PDO dsn connection string

php7 has begun to use pdo to connect to mysql database

Home/Conf/Config.php under the module under thinkphp file

Load the following

//Database configuration

<code>'DB_TYPE'  =>'mysql',
'DB_HOST'  =>'localhost',
'DB_PORT'  =>'3306',
'DB_NAME'  =>'数据库名称',
'DB_USER'  =>'数据库用户名',
'DB_PWD'   =>'数据库密码',
'DB_CHARSET'=>'utf8',</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn