复制代码 代码如下:
<?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);
}
?>
新闻热点
疑难解答