PHP关闭notice级别的错误提示

1、在php.ini文件中改动error_reporting改为:

error_reporting=E_ALL & ~E_NOTICE

 

2、如果你不能操作php.ini文件,你可以使用如下方法

在你想禁止notice错误提示的页面中加入如下代码:

error_reporting(E_ALL^E_NOTICE);

error_reporting(0);

 

 

另外附上

PHP error_reporting() 函数

<?php
 // 关闭错误报告
 error_reporting(0);

 // 报告 runtime 错误
 error_reporting(E_ERROR | E_WARNING | E_PARSE);

 // 报告所有错误
 error_reporting(E_ALL);

 // 等同 error_reporting(E_ALL);
 ini_set("error_reporting", E_ALL);

 // 报告 E_NOTICE 之外的所有错误
 error_reporting(E_ALL & ~E_NOTICE);
?> 

 

posted @ 2018-09-04 15:16  居委会-王某人  阅读(494)  评论(0编辑  收藏  举报