當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PMA_Error::getHash方法代碼示例

本文整理匯總了PHP中PMA_Error::getHash方法的典型用法代碼示例。如果您正苦於以下問題:PHP PMA_Error::getHash方法的具體用法?PHP PMA_Error::getHash怎麽用?PHP PMA_Error::getHash使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PMA_Error的用法示例。


在下文中一共展示了PMA_Error::getHash方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addError

 /**
  * Add an error; can also be called directly (with or without escaping)
  *
  * The following error types cannot be handled with a user defined function:
  * E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR,
  * E_COMPILE_WARNING,
  * and most of E_STRICT raised in the file where set_error_handler() is called.
  *
  * Do not use the context parameter as we want to avoid storing the
  * complete $GLOBALS inside $_SESSION['errors']
  *
  * @param string  $errstr  error string
  * @param integer $errno   error number
  * @param string  $errfile error file
  * @param integer $errline error line
  * @param boolean $escape  whether to escape the error string
  *
  * @return void
  */
 public function addError($errstr, $errno, $errfile, $errline, $escape = true)
 {
     if ($escape) {
         $errstr = htmlspecialchars($errstr);
     }
     // create error object
     $error = new PMA_Error($errno, $errstr, $errfile, $errline);
     // do not repeat errors
     $this->errors[$error->getHash()] = $error;
     switch ($error->getNumber()) {
         case E_USER_NOTICE:
         case E_USER_WARNING:
         case E_STRICT:
         case E_DEPRECATED:
         case E_NOTICE:
         case E_WARNING:
         case E_CORE_WARNING:
         case E_COMPILE_WARNING:
         case E_USER_ERROR:
         case E_RECOVERABLE_ERROR:
             // just collect the error
             // display is called from outside
             break;
         case E_ERROR:
         case E_PARSE:
         case E_CORE_ERROR:
         case E_COMPILE_ERROR:
         default:
             // FATAL error, display it and exit
             $this->dispFatalError($error);
             exit;
     }
 }
開發者ID:ecssjapan,項目名稱:guiding-you-afteropen,代碼行數:52,代碼來源:Error_Handler.class.php

示例2: handleError

    /**
     * Error handler - called when errors are triggered/occured
     *
     * The following error types cannot be handled with a user defined function:
     * E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR,
     * E_COMPILE_WARNING,
     * and most of E_STRICT raised in the file where set_error_handler() is called.
     *
     * @uses    E_USER_NOTICE
     * @uses    E_USER_WARNING
     * @uses    E_STRICT
     * @uses    E_NOTICE
     * @uses    E_WARNING
     * @uses    E_CORE_WARNING
     * @uses    E_COMPILE_WARNING
     * @uses    E_USER_ERROR
     * @uses    E_ERROR
     * @uses    E_PARSE
     * @uses    E_CORE_ERROR
     * @uses    E_COMPILE_ERROR
     * @uses    E_RECOVERABLE_ERROR
     * @uses    PMA_Error
     * @uses    PMA_Error_Handler::$_errors
     * @uses    PMA_Error_Handler::_dispFatalError()
     * @uses    PMA_Error::getHash()
     * @uses    PMA_Error::getNumber()
     * @param   integer $errno
     * @param   string  $errstr
     * @param   string  $errfile
     * @param   integer $errline
     * @param   array   $errcontext
     */
    public function handleError($errno, $errstr, $errfile, $errline, $errcontext)
    {
        // create error object
        $error = new PMA_Error($errno, $errstr, $errfile, $errline, $errcontext);

        // do not repeat errors
        $this->_errors[$error->getHash()] = $error;

        switch ($error->getNumber()) {
            case E_USER_NOTICE:
            case E_USER_WARNING:
            case E_STRICT:
            case E_DEPRECATED:
            case E_NOTICE:
            case E_WARNING:
            case E_CORE_WARNING:
            case E_COMPILE_WARNING:
            case E_USER_ERROR:
            case E_RECOVERABLE_ERROR:
                // just collect the error
                // display is called from outside
                break;
            case E_ERROR:
            case E_PARSE:
            case E_CORE_ERROR:
            case E_COMPILE_ERROR:
            default:
                // FATAL error, dislay it and exit
                $this->_dispFatalError($error);
                exit;
                break;
        }
    }
開發者ID:blumenbach,項目名稱:blumenbach-online.de,代碼行數:65,代碼來源:Error_Handler.class.php


注:本文中的PMA_Error::getHash方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。