无法访问受保护的属性CI_Output :: enable_profiler

时间:2013-07-10 10:11:58

标签: codeigniter codeigniter-2

我正在将我的网站从旧版本的codeigniter升级到新版本但我在升级过程中收到错误“无法访问受保护的属性CI_Output :: enable_profiler”。我知道属性enable_profiler在新版本中受到保护。但我不知道如何在我的控制器/模型中访问此属性。我不想更改现有代码。以下是我的代码

if($this->output->enable_profiler)
{
   .......
}

2 个答案:

答案 0 :(得分:0)

请阅读CI文档,您可以使用以下方法启用禁用性能分析

$this->output->enable_profiler(TRUE);// to enable

$this->output->enable_profiler(FALSE); // to disable

profiling

答案 1 :(得分:0)

$this->output->enable_profiler(FALSE);

class CI_Output的返回类型无效
/**
 * Enable/disable Profiler
 *
 * @access  public
 * @param   bool
 * @return  void
 */
function enable_profiler($val = TRUE)
{
    $this->enable_profiler = (is_bool($val)) ? $val : TRUE;

    return $this;
}
相关问题