Home  >  Article  >  Backend Development  >  Tp5 project modification database

Tp5 project modification database

不言
不言Original
2018-05-03 10:06:214032browse

This article mainly introduces the modification of the Tp5 project database, which has certain reference value. Now I share it with everyone. Friends in need can refer to it

  1. Setting model

 'mysql',  
        // 数据库连接DSN配置  
        'dsn'         => '',  
        // 服务器地址  
        'hostname'    => '127.0.0.1',  
        // 数据库名  
        'database'    => '',  
        // 数据库用户名  
        'username'    => 'root',  
        // 数据库密码  
        'password'    => '123456',  
        // 数据库连接端口  
        'hostport'    => '3306',  
        // 数据库连接参数  
        'params'      => [],  
        // 数据库编码默认采用utf8  
        'charset'     => 'utf8',  
        // 数据库表前缀  
        'prefix'      => '',  
    ]; 
}

2. Copy the Db class and name it Db1,


Edit database1 (database Configuration) ->Under the root directory extra

The usage is consistent with Db

Related recommendations:

tp5 operation mongoDB database instance

TP5 Auth permission management example

The above is the detailed content of Tp5 project modification database. For more information, please follow other related articles on the PHP Chinese website!

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