0

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

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

2 回答 2

0

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

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

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

分析

于 2013-07-10T10:21:43.163 回答
0

$this->output->enable_profiler(FALSE);In的返回类型为 voidclass 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;
}
于 2013-07-10T11:06:48.257 回答