This commit is contained in:
thinkphp
2015-12-16 09:51:46 +08:00
parent d8ad614ae0
commit 55a223aef4
2 changed files with 160 additions and 0 deletions

View File

@@ -17,6 +17,27 @@ class Debug
protected static $info = [];
protected static $mem = [];
/**
* 操作句柄
* @var object
* @access protected
*/
protected static $handler = null;
/**
* 初始化调试驱动
* @access public
* @param array $options 配置数组
* @return object
*/
public static function init($options = [])
{
$type = !empty($options['type']) ? $options['type'] : 'Local';
$class = 'think\\debug\\driver\\' . ucwords($type);
self::$handler = new $class($options);
return self::$handler;
}
/**
* 记录时间(微秒)和内存使用情况
* @param string $name 标记位置
@@ -121,4 +142,10 @@ class Debug
return $output;
}
}
// 静态调用
public static function __callStatic($method, $params)
{
return call_user_func_array([self::$handler, $method], $params);
}
}