[CI]多数据库配置使用
1.在database.php配置文件中 加入
$db['[color=red]second[/color]']['hostname'] = '[color=red]localhost[/color]';$db['second']['username'] = 'root';$db['second']['password'] = 'root';$db['second']['database'] = '[color=red]ci_0_2[/color]';$db['second']['dbdriver'] = 'mysql';$db['second']['dbprefix'] = '';$db['second']['pconnect'] = TRUE;$db['second']['db_debug'] = TRUE;$db['second']['cache_on'] = FALSE;$db['second']['cachedir'] = '';$db['second']['char_set'] = 'utf8';$db['second']['dbcollat'] = 'utf8_general_ci';$db['second']['swap_pre'] = '';$db['second']['autoinit'] = TRUE;$db['[color=red]second[/color]']['stricton'] = FALSE;
function __construct(){parent::__construct();$this->[color=red]second_db[/color] = $this->load->database('[color=red]second[/color]', true);}function verify_users($email, $password){$q = $this->[color=red]second_db[/color]->where('email', $email)->where('password', sha1($password))->limit(1)->get('users');if($q->num_rows > 0){return $q->row();}return false;}