Recorder.class.php
1.25 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
49
50
51
52
53
54
55
56
57
58
59
<?php
/* PHP SDK
* @version 2.0.0
* @author connect@qq.com
* @copyright © 2013, Tencent Corporation. All rights reserved.
*/
require_once(QC_CLASS_PATH.'ErrorCase.class.php');
class Recorder{
private static $data;
private $inc;
private $error;
public function __construct(){
$this->error = new ErrorCase();
//-------读取配置文件
$this->inc = require(QC_CLASS_PATH.'../Config.inc.php');
if(empty($this->inc)){
$this->error->showError("20001");
}
if(empty($_SESSION['QC_userData'])){
self::$data = array();
}else{
self::$data = $_SESSION['QC_userData'];
}
}
public function write($name,$value){
self::$data[$name] = $value;
}
public function read($name){
if(empty(self::$data[$name])){
return null;
}else{
return self::$data[$name];
}
}
public function readInc($name){
if(empty($this->inc[$name])){
return null;
}else{
return $this->inc[$name];
}
}
public function delete($name){
unset(self::$data[$name]);
}
function __destruct(){
$_SESSION['QC_userData'] = self::$data;
}
}