; error_reporting is a bit-field. Or each number up to get desired error ; reporting level ; E_ALL - All errors and warnings (doesn't include E_STRICT) ; E_ERROR - fatal run-time errors ; E_RECOVERABLE_ERROR - almost fatal run-time errors ; E_WARNING - run-time warnings (non-fatal errors) ; E_PARSE - compile-time parse errors ; E_NOTICE - run-time notices (these are warnings which often result ; from a bug in your code, but it's possible that it was ; intentional (e.g., using an uninitialized variable and ; relying on the fact it's automatically initialized to an ; empty string) ; E_STRICT - run-time notices, enable to have PHP suggest changes ; to your code which will ensure the best interoperability ; and forward compatibility of your code ; E_CORE_ERROR - fatal errors that occur during PHP's initial startup ; E_CORE_WARNING - warnings (non-fatal errors) that occur during PHP's ; initial startup ; E_COMPILE_ERROR - fatal compile-time errors ; E_COMPILE_WARNING - compile-time warnings (non-fatal errors) ; E_USER_ERROR - user-generated error message ; E_USER_WARNING - user-generated warning message ; E_USER_NOTICE - user-generated notice message ; ; Examples: ; ; - Show all errors, except for notices and coding standards warnings ; ;error_reporting = E_ALL & ~E_NOTICE ; ; - Show all errors, except for notices ; ;error_reporting = E_ALL & ~E_NOTICE | E_STRICT ; ; - Show only errors ; ;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR ; ; - Show all errors except for notices and coding standards warnings ; error_reporting = E_ALL & ~E_NOTICE
<?php
error_reporting (0);
function error_handler ($error_level, $error_message, $file, $line) {
$EXIT = FALSE;
switch ($error_level) {
case E_NOTICE:
case E_USER_NOTICE:
$error_type = 'Notice';
break;
case E_WARNING:
case E_USER_WARNING:
$error_type = 'Warning';
break;
case E_ERROR:
case E_USER_ERROR:
$error_type = 'Fatal Error';
$EXIT = TRUE;
break;
default:
$error_type = 'Unknown';
$EXIT = TRUE;
break;
}
printf ("%s: %s in %s on line %d\n", $error_type, $error_message, $file, $line);
if ($EXIT) {
die();
}
}
set_error_handler ('error_handler');
//new NonExist();
echo $novar;
echo 3/0;
trigger_error ('Trigger a fatal error', E_USER_ERROR);
new NonExist();
?>
Notice: Undefined variable: novar in /your/php_demo_file.php on line 40 Warning: Division by zero in /your/php_demo_file.php on line 41 Fatal Error: Trigger a fatal error in /your/php_demo_file.php on line 42
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有