2013-07-10 39 views
0

我正在將舊版本的codeigniter升級到新版本,但在升級過程中出現「無法訪問受保護的屬性CI_Output :: enable_profiler」錯誤。我知道屬性enable_profiler已經在新版本中受到保護。但我不知道如何在控制器/模型中訪問此屬性。我不想改變我現有的代碼。以下是我的代碼無法訪問受保護的屬性CI_Output :: enable_profiler

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

回答

0

請仔細閱讀您可以使用下面的方法來啓用禁用分析的CI DOC

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

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

profiling

+0

我不想啓用或禁用分析器。我想檢查探查器是啓用還是禁用。 $ this-> output-> enable_profiler屬性返回true或false來表明探查器已啓用或已禁用。 – aishazafar

0

的返回類型爲void爲$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; 
} 
相關問題