简体   繁体   中英

PHP error_reporting to suppress notices and warnings

I have this set in php.ini :

error_reporting = E_ALL ^ E_WARNING ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT

Yet I'm still seeing things like this:

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/web/wp-content/plugins/folders/includes/types.php on line 188

I would like to suppress all notices and warnings.

To suppress only notices and warnings set
error_reporting = E_ALL & ~E_WARNINGS & ~E_NOTICE

try adding this line to the beginning of your php script, that will hide all the errors.

<?php error_reporting(0);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM