,
구성 파일은 app/Config/Database.php
.env 파일에서 데이터베이스 연결 값을 설정 가능
public $default = [
'DSN' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'database_name',
'DBDriver' => 'MySQLi',
'DBPrefix' => '',
'pConnect' => TRUE,
'DBDebug' => TRUE,
'charset' => 'utf8',
'DBCollat' => 'utf8_general_ci',
'swapPre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'strictOn' => FALSE,
'failover' => [],
];
DSN 사용시
// PDO
$default['DSN'] = 'pgsql:host=localhost;port=5432;dbname=database_name';
// Oracle
$default['DSN'] = '//localhost/XE';
$default['DSN'] = 'DBDriver://username:password@hostname:port/database';
// MySQLi
$default['DSN'] = 'MySQLi://username:password@hostname:3306/database?charset=utf8&DBCollat=utf8_general_ci';
// Postgre
$default['DSN'] = 'Postgre://username:password@hostname:5432/database?charset=utf8&connect_timeout=5&sslmode=1';
[Codeigniter]Database Query (0) | 2020.11.25 |
---|---|
[Codeigniter]Database Connection (0) | 2020.11.24 |
[Bootstrap]Spinner (0) | 2020.11.12 |
[Bootstrap]Slide Caption (0) | 2020.11.11 |
[Bootstrap]Modal view (0) | 2020.11.10 |