时间:2021-07-01 10:21:17 帮助过:7人阅读
function myError($errno,$errstr,$errfile,$errline){
switch($errno){
case E_USER_ERROR:
echo "My ERROR[$errno] $errstr
";
echo "Fatal error in line $errline of file $errfile";
exit(1);
break;
case E_USER_WARNING:
echo "My WARNING [$errno] $errstr";
break;
default:
echo "Unknown error type:[$errno] $errstr";
break;
}
}
set_error_handler("myError");
$age=-100;
if($age<0){
trigger_error('age you input must>=0',E_USER_ERROR);
}
?>