handle.php

来自「php源码 php源码参考」· PHP 代码 · 共 30 行

PHP
30
字号
<?php
  // The error handler function
  function myErrorHandler ($errno, $errstr, $errfile, $errline)
  {
    echo "<br /><table bgcolor='#cccccc'><tr><td>
          <p><b>ERROR:</b> $errstr</p>
          <p>Please try again, or contact us and tell us that
          the error occurred in line $errline of file '$errfile'</p>";
    if ($errno == E_USER_ERROR||$errno == E_ERROR)
    {
      echo '<p>This error was fatal, program ending</p>';
      echo '</td></tr></table>';
      //close open resources, include page footer, etc
      exit;
    }
    echo '</td></tr></table>';
  }
  // Set the error handler
  set_error_handler('myErrorHandler');

  //trigger different levels of error
  trigger_error('Trigger function called', E_USER_NOTICE);
  fopen('nofile', 'r');
  trigger_error('This computer is beige', E_USER_WARNING); 
  include ('nofile');
  trigger_error('This computer will self destruct in 15 seconds', E_USER_ERROR);
?>


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?