简体   繁体   中英

database.php settings for CodeIgniter and Parse Server

Has anyone ever used CodeIgniter + Parse Server? I would like to use the two in conjunction but I don't know what to do with the settings in the database.php file.

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = 'root';
$db['default']['database'] = '';
$db['default']['dbdriver'] = '';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

You can use multiple database in codeigniter, Just add below lines in same file database.php

$db['second_db']['hostname'] = 'localhost';
$db['second_db']['username'] = 'mysql_username';
$db['second_db']['password'] = 'mysql_password';
$db['second_db']['database'] = 'admin';  
// More config in same way, if required

Access default database:

$this->load->database();
$query = $this->db->query();

Access the second database

$second_db= $this->load->database('second_db', TRUE);
$query = $second_db->query();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM