运行 ❯
获取您自己的
PHP
服务器
×
更改方向
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <body> <?php // A user-defined error handler function function myErrorHandler($errno, $errstr, $errfile, $errline) { echo "<b>Custom error:</b> [$errno] $errstr<br>"; echo " Error on line $errline in $errfile<br>"; } // Set user-defined error handler function set_error_handler("myErrorHandler"); $test=2; // Trigger error if ($test>1) { trigger_error("A custom error has been triggered"); } // Restore previous error handler restore_error_handler(); // Trigger error again if ($test>1) { trigger_error("A custom error has been triggered"); } ?> </body> </html>