ErrorCase.class.php
1.37 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/* PHP SDK
* @version 2.0.0
* @author connect@qq.com
* @copyright © 2013, Tencent Corporation. All rights reserved.
*/
require_once(QC_CLASS_PATH.'Recorder.class.php');
/*
* @brief ErrorCase类,封闭异常
* */
class ErrorCase{
private $errorMsg;
public function __construct(){
$this->errorMsg = array(
"20001" => "<h2>配置文件损坏或无法读取,请重新执行intall</h2>",
"30001" => "<h2>The state does not match. You may be a victim of CSRF.</h2>",
"50001" => "<h2>可能是服务器无法请求https协议</h2>可能未开启curl支持,请尝试开启curl支持,重启web服务器,如果问题仍未解决,请联系我们"
);
}
/**
* showError
* 显示错误信息
* @param int $code 错误代码
* @param string $description 描述信息(可选)
*/
public function showError($code, $description = '$'){
$recorder = new Recorder();
if(! $recorder->readInc("errorReport")){
die();//die quietly
}
echo "<meta charset=\"UTF-8\">";
if($description == "$"){
die($this->errorMsg[$code]);
}else{
echo "<h3>error:</h3>$code";
echo "<h3>msg :</h3>$description";
exit();
}
}
public function showTips($code, $description = '$'){
}
}