ci 中使用 pdo 连接 mysql

ci 版本为 3.0.6

config/database.php 文件内容如下

$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
    'dsn' => '',
    'hostname' => 'mysql:dbname=test;host=127.0.0.1',
    'username' => 'root',
    'password' => '123456',
    'database' => 'test',
    'dbdriver' => 'pdo',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);

 

posted @ 2016-07-01 16:15  Debm.Zhang  阅读(...)  评论(...编辑  收藏