如何在CodeIgniter模型中动态更改数据库设置'db_debug'的值? [重复]

问题描述:

This question already has an answer here:

A piece of database setting in my CodeIgniter development environment.

$db['development']['pconnect'] = TRUE;
$db['development']['db_debug'] = TRUE;
$db['development']['cache_on'] = FALSE;

But there is a model that I should turn the value of 'db_debug' into FALSE, because the debug info will interrupt the execution of my PHP code. How can I do that?

I have Google it for a long time, I am quite appreciate that someone could solve my problem.

</div>

此问题已经存在 这里有一个答案: p>

  • Codeigniter在运行时更改数据库配置 5 answers span> \ n li> ul> div>

    我的CodeIgniter开发环境中的一个数据库设置。 p>

       $ db ['development'] ['pconnect'] = TRUE; 
     $ db ['development'] ['db_debug'] = TRUE; 
     $ db ['development'] ['cache_on'] =  FALSE; 
      code>  pre> 
     
     

    但是有一个模型我应该将'db_debug'的值变为FALSE,因为调试信息会中断我的PHP代码的执行。 我该怎么办? p>

    我有谷歌很长一段时间,我很欣赏有人可以这么做 解决我的问题。 p> div>

You can access db_debug as a public variable:

$this->db->db_debug = FALSE;