
Paste_Image.png

Paste_Image.png

Paste_Image.png

Paste_Image.png

Paste_Image.png

Paste_Image.png

Paste_Image.png
<?php
header("content-type:text/html;charset=utf-8");
error_reporting(-1);
function customError($errno, $errmsg, $file, $line)
{
echo "<b>错误代码:<b/>[{$errno}]{$errmsg}<br/>" . PHP_EOL;
echo "<b>错误行号:</b>{$file}文件中的第{$line}行<br/>" . PHP_EOL;
echo "<b>PHP版本:</b>" . PHP_VERSION . "(" . PHP_OS . ")<br/>" . PHP_EOL;
}
set_error_handler('customError');
echo $test;
?>

Paste_Image.png
<?php
header("content-type:text/html;charset=utf-8");
error_reporting(-1);
function customError($errno, $errmsg, $file, $line)
{
echo "<b>错误代码:<b/>[{$errno}]{$errmsg}<br/>" . PHP_EOL;
echo "<b>错误行号:</b>{$file}文件中的第{$line}行<br/>" . PHP_EOL;
echo "<b>PHP版本:</b>" . PHP_VERSION . "(" . PHP_OS . ")<br/>" . PHP_EOL;
}
set_error_handler('customError');
echo $test;
echo "<hr/>";
settype($var, 'king');
echo "<hr/>";
//test();Fatal Error 无法使用自定义函数(向下执行)
trigger_error('this is a test of error', E_USER_ERROR);
echo "<hr/>";
//取消接管
restore_error_handler();
echo $king;
echo "<hr/>";
set_error_handler('customError', E_ALL & ~E_NOTICE);
echo $imooc;
echo "<hr/>";
settype($var,'king');
echo "<hr/>";
echo "continue";
?>

Paste_Image.png
网友评论