时间:2021-07-01 10:21:17 帮助过:3人阅读
<?php
function myError($errno,$errstr,$errfile,$errline){
switch($errno){
case E_USER_ERROR:
echo "<b>My ERROR</b>[$errno] $errstr<br />";
echo "Fatal error in line $errline of file $errfile";
exit(1);
break;
case E_USER_WARNING:
echo "<b>My WARNING</b> [$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);
}
?>