Home  >  Article  >  PHP Framework  >  yii close error prompt

yii close error prompt

(*-*)浩
(*-*)浩Original
2019-11-05 14:39:362722browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn