-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathObject.php
More file actions
executable file
·69 lines (61 loc) · 1.36 KB
/
Object.php
File metadata and controls
executable file
·69 lines (61 loc) · 1.36 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
60
61
62
63
64
65
66
67
68
69
<?php
/**
* Created by PhpStorm.
* User: apple
* Date: 2017/2/16
* Time: 18:36
*/
namespace core;
use core\AR\db;
class Object{
/**
* 获取配置组件
* @var object
*/
public $config;
/**
* db组件
* @var object
*/
public $db;
/**
* 命名空间
* @var string
*/
public $namespace;
/**
* 类名(完整类名)
* @var string
*/
public $className;
/**
* 类名(去掉命名空间的类名)
* @var string
*/
public $shortName;
/**
* Object constructor.
*/
public function __construct()
{
$class = get_called_class();
$class = new \ReflectionClass($class);
$this->namespace = $class->getNamespaceName();
$this->className = $class->getName();
$this->shortName = $class->getShortName();
$this->config = Config::getConfig();
$this->db = new db();
}
/**
* 公共的记录日志方法,日志存储方式由配置文件决定
* @param $fileName
* @param string $content
* @param array $array
* @return mixed
*/
public function log($fileName, $content = '', $array = []){
$logConfig = Config::getConfig('log');
$logObj = "\\core\\log\\Log" . $logConfig['type'];
return (new $logObj)->log($fileName, $content, $array);
}
}