Home > Article > PHP Framework > yii close error prompt
Change error_reporting in the php.ini file to: (Recommended learning: yii tutorial)
error_reporting=E_ALL & ~E_NOTICE
If you cannot operate the php.ini file, you can use the following method to add the following code to the page where you want to disable notice error prompts:
/* Report all errors except E_NOTICE */ error_reporting(E_ALL^E_NOTICE);
Use the above method, in 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();in the entry file
The above is the detailed content of yii close error prompt. For more information, please follow other related articles on the PHP Chinese website!