Codeigniter change database config at runtime

前端 未结 5 1621
没有蜡笔的小新
没有蜡笔的小新 2021-01-03 00:44

Can I change the database config per method in a controller?

$db[\'default\'][\'db_debug\'] = TRUE;

The default is TRUE, while

5条回答
  •  温柔的废话
    2021-01-03 01:21

    I checked the code of system/database/DB_Driver and found that:

    $this->db->db_debug = FALSE;
    

    will work in my controller to enable/disable the debug thing on the fly.

提交回复
热议问题