<delect id="sj01t"></delect>
  1. <em id="sj01t"><label id="sj01t"></label></em>
  2. <div id="sj01t"></div>
    1. <em id="sj01t"></em>

            <div id="sj01t"></div>
            php語言

            php自定義錯誤處理用法實例

            時間:2024-12-26 23:59:28 php語言 我要投稿
            • 相關推薦

            php自定義錯誤處理用法實例

              php自定義錯誤處理用法,實例分析了php通過自定義函數進行錯誤處理的技巧,需要的朋友可以參考下.

            php自定義錯誤處理用法實例

              本文實例講述了php自定義錯誤處理用法。分享給大家供大家參考。具體如下:

              <?php

              error_reporting(E_ALL);

              function ErrHandler($errorno, $errorstr, $errorfile, $errorline)

              {

              $display = true;

              $notify = false;

              $halt_script = false;

              $error_msg = "<br>The $errorno error is occurring at $errorline in

              $errorfile<br>";

              switch($errorno)

              {

              case E_USER_NOTICE:

              case E_NOTICE:

              $halt_script = false;

              $notify = true;

              $label = "<B>Notice</B>";

              break;

              case E_USER_WARNING:

              case E_WARNING:

              $halt_script = false;

              $notify = true;

              $label = "<b>Warning</b>";

              break;

              case E_USER_ERROR:

              case E_ERROR:

              $label = "<b>Fatal Error</b>";

              $notify=true;

              $halt_script = false;

              break;

              case E_PARSE:

              $label = "<b>Parse Error</b>";

              $notify=true;

              $halt_script = true;

              break;

              default:

              $label = "<b>Unknown Error</b>";

              break;

              }

              if($notify)

              {

              $msg = $label . $error_msg;

              echo $msg;

              }

              if($halt_script) exit -1;

              }

              $error_handler = set_error_handler("ErrHandler");

              echo "<BR><H2>Using Custom Error Handler</h2><BR>";

              trigger_error("<BR>Error caused by E_USER_NOTICE</BR>", E_USER_NOTICE);

              trigger_error("<BR>Error caused by E_USER_WARNING</BR>", E_USER_WARNING);

              trigger_error("<BR>Error caused by E_USER_ERROR</BR>", E_USER_ERROR);

              trigger_error("<BR>Error caused by E_PARSE</BR>", E_PARSE);

            【php自定義錯誤處理用法實例】相關文章:

            php中fsockopen用法實例06-20

            php自定義錯誤日志實例詳解07-15

            php之readdir函數用法實例09-21

            php中return的用法實例分析10-27

            PHP學習入門之PHP錯誤處理07-14

            PHP生成自定義長度隨機字符串實例07-22

            php畫圖實例07-16

            php中三元運算符用法實例08-25

            php查詢mysql的實例09-09

            <delect id="sj01t"></delect>
            1. <em id="sj01t"><label id="sj01t"></label></em>
            2. <div id="sj01t"></div>
              1. <em id="sj01t"></em>

                      <div id="sj01t"></div>
                      黄色视频在线观看