yii关闭错误提示

互联网 19-11-5

在php.ini文件中改动error_reporting改为: (推荐学习:yii教程)

error_reporting=E_ALL & ~E_NOTICE

如果你不能操作php.ini文件,你可以使用如下方法在你想禁止notice错误提示的页面中加入如下代码:

/* Report all errors except E_NOTICE */ error_reporting(E_ALL^E_NOTICE);

使用以上方法,在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();

以上就是yii关闭错误提示的详细内容,更多内容请关注技术你好其它相关文章!

来源链接:
免责声明:
1.资讯内容不构成投资建议,投资者应独立决策并自行承担风险
2.本文版权归属原作所有,仅代表作者本人观点,不代表本站的观点或立场
标签: Yii
上一篇:php获取远程图片并下载保存到本地的方法分析 下一篇:yii2怎么访问控制器

相关资讯