2011-05-09 101 views
0

有沒有辦法強制codeigniter顯示聰明的錯誤?codeigniter smarty空白頁問題

我想包括一個文件:

{include file="header.tpl.php"} 

,但結果我有一個空白頁,沒有錯誤。

我必須設置爲E_ALL並正在顯示PHP錯誤錯誤。

謝謝。

+0

是否啓用了[Smarty錯誤報告](http://www.smarty.net/docsv2/en/variable.error.reporting.tpl)?還可能感興趣的:http://www.smarty.net/forums/viewtopic.php?t=11351](http://www.smarty.net/forums/viewtopic.php?t=11351) – 2011-05-09 13:36:29

+0

是我做$ config ['error_reporting'] =「E_ALL」; – miojamo 2011-05-09 13:39:44

回答

3

Smarty的改變,當它被調用錯誤報告級別,並且在返回之前換了回來。你如何更改設置將取決於你如何使用Smarty的,並與笨它整合 - 對我來說,我可以在配置/ smarty.php改變它,但核心Smarty的方法是這樣的:

$smarty->error_reporting = E_ALL & ~E_NOTICE; 

如果您擴展了Smarty類,使你自己的,你可能要像

$this->error_reporting = E_ALL & ~E_NOTICE; 

在你的構造來代替。

如果你這樣做,錯誤應該開始露出來了!

+0

太棒了!它在Smarty.php中更改後,很奇怪,這不起作用:$ this-> error_reporting = $ this-> CI-> config-> item('error_reporting');並在配置是$ config ['error_reporting'] =「E_ALL&〜E_NOTICE」; – miojamo 2011-05-10 05:44:02

+0

這是在我的配置:$ config ['error_reporting'] = E_ALL&〜E_NOTICE;請注意,E_ALL位不應有引號,E_ALL和E_NOTICE是常量。 – ZoFreX 2011-05-10 08:27:50