公告
财富商城
积分规则
提问
发文
2019-01-03 12:30发布
手持菜刀,她持情操
I have some PHP code. When I run it, a warning message appears.
How can I remove/suppress/ignore these warning messages?
If you want to suppress the warnings and some other error types (for example, notices) while displaying all other errors, you can do:
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);
You really should fix whatever's causing the warning, but you can control visibility of errors with error_reporting. To skip warning messages, you could use something like:
error_reporting(E_ERROR | E_PARSE);
in Core Php to hide warning message set error_reporting(0) at top of common include file or individual file.
In Wordpress hide Warnings and Notices add following code in wp-config.php file
ini_set('log_errors','On'); ini_set('display_errors','Off'); ini_set('error_reporting', E_ALL ); define('WP_DEBUG', false); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);
You could suppress the warning using error_reporting but the much better way is to fix your script in the first place.
If you don't know how, edit your question and show us the line in question and the warning that is displayed.
If you don't want to show warnings as well as errors use
// Turn off all error reporting error_reporting(0);
Error Reporting - PHP Manual
You can put an @ in front of your function call to suppress all error messages.
@yourFunctionHere();
最多设置5个标签!
If you want to suppress the warnings and some other error types (for example, notices) while displaying all other errors, you can do:
You really should fix whatever's causing the warning, but you can control visibility of errors with error_reporting. To skip warning messages, you could use something like:
in Core Php to hide warning message set error_reporting(0) at top of common include file or individual file.
In Wordpress hide Warnings and Notices add following code in wp-config.php file
You could suppress the warning using error_reporting but the much better way is to fix your script in the first place.
If you don't know how, edit your question and show us the line in question and the warning that is displayed.
If you don't want to show warnings as well as errors use
Error Reporting - PHP Manual
You can put an @ in front of your function call to suppress all error messages.