Ejemplo n.º 1
0
 /**
  * 对错误进行分解
  */
 private static function _categoryError()
 {
     //分级
     $categoryErrors = array();
     self::$errorList = array_reverse(self::$errorList);
     foreach (self::$errorList as $val) {
         $tips = 'ErrorException';
         switch ($val[0]) {
             case 1:
                 $lv = '致命错误';
                 $tips = 'Fatal Error';
                 break;
             case 2:
                 $lv = '运行警告';
                 $tips = 'Warning';
                 break;
             case 4:
                 $lv = '解析错误';
                 break;
             case 8:
                 $lv = '运行提示';
                 $tips = 'Notice';
                 break;
             case 16:
                 $lv = 'PHP内核错误';
                 $tips = 'Core Error';
                 break;
             case 32:
                 $lv = 'PHP内核警告';
                 $tips = 'Core Warning';
                 break;
             case 64:
                 $lv = 'Zend致命错误';
                 break;
             case 128:
                 $lv = 'Zend运行警告';
                 $tips = 'Zend Warning';
                 break;
             case 256:
                 $lv = '自定义错误';
                 $tips = 'USER Error';
                 break;
             case 512:
                 $lv = '自定义警告';
                 $tips = 'USER Warning';
                 break;
             case 1024:
                 $lv = '自定义通知';
                 $tips = 'USER Notice';
                 break;
             case 2048:
                 $lv = '代码通知';
                 return false;
             case 10000:
                 $lv = '安全警告';
                 return false;
             default:
                 $lv = '致命错误';
         }
         //错误代码
         $errorText = self::getErrorText($val[2], $val[3]);
         $categoryErrors[] = array('code' => $val[0], 'content' => $val[1], 'file' => self::filterFileTruePath($val[2]), 'line' => $val[3], 'level' => $lv, 't_tips' => $tips, 'detail' => $errorText);
     }
     //返回分级后的错误
     return $categoryErrors;
 }