YII中關閉notice級別的錯誤提示

1、在php.ini文件中改動error_reporting
改爲:
error_reporting=E_ALL & ~E_NOTICE
2、如果你不能操作php.ini文件,你可以使用如下方法
在你想禁止notice錯誤提示的頁面中加入如下代碼:
/* Report all errors except E_NOTICE */
error_reporting(E_ALL^E_NOTICE);

以上方法轉自:http://blog.163.com/swordsman01@126/blog/static/1157577212012030102848197/

 

使用以上方法,在YII的入口文件中protected/index.php

error_reporting(E_ALL^E_NOTICE);
// change the following paths if necessary
$yii=dirname(__FILE__).'/../framework/yii.php';
$config=dirname(__FILE__).'/protected/config/main.php';

//引用系統常量配置文件
require_once dirname(__FILE__).'/protected/config/constant.php';

// remove the following lines when in production mode
defined('YII_DEBUG') or define('YII_DEBUG',true);
// specify how many levels of call stack should be shown in each log message
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);

require_once($yii);
Yii::createWebApplication($config)->run();


 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章