我正在将我的站点从旧版本的 codeigniter 升级到新版本,但在升级过程中出现错误“无法访问受保护的属性 CI_Output::enable_profiler”。我知道属性 enable_profiler 已在新版本中受到保护。但我不知道如何在我的控制器/模型中访问此属性。我不想更改我现有的代码。以下是我的代码
if($this->output->enable_profiler)
{
.......
}
我正在将我的站点从旧版本的 codeigniter 升级到新版本,但在升级过程中出现错误“无法访问受保护的属性 CI_Output::enable_profiler”。我知道属性 enable_profiler 已在新版本中受到保护。但我不知道如何在我的控制器/模型中访问此属性。我不想更改我现有的代码。以下是我的代码
if($this->output->enable_profiler)
{
.......
}
请阅读 CI 文档,您可以使用以下方法启用禁用分析
$this->output->enable_profiler(TRUE);// to enable
$this->output->enable_profiler(FALSE); // to disable
$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;
}