-
Notifications
You must be signed in to change notification settings - Fork 0
/
Abnormal.class.php
36 lines (33 loc) · 1.05 KB
/
Abnormal.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
defined('IN_TEMPLI') or die('非法引用');
/**
* 异常处理类
* @author 七觞酒
* @email 739800600@qq.com
* @date 2013-3-19
*/
class Abnormal extends Exception{
/*public function __construct($message, $code=0, $previous=true){
parent::__construct($message, $code);
}*/
public function __toString(){
$trace = $this->getTrace();
array_shift($trace); //去除抛出异常处文件跟踪
$traceInfo ='';
$time =date('y-m-d H:i:s');
foreach($trace as $key => $val){
//print_r($val['args']);
$traceInfo .= sprintf("#%d [%s] %s(%d) %s%s%s(%s)\n",
$key,
$time,
$val['file'],
$val['line'],
$val['class'],
$val['type'],
$val['function'],
implode(',', $val['args'])
);
}
return $traceInfo;
}
}