-
Notifications
You must be signed in to change notification settings - Fork 742
HanSon edited this page Mar 17, 2017
·
5 revisions
除了消息以及用户的类以外,Vbot还提供了3个support类,方便平时使用
Console::log($str, $level = 'INFO')用于字符串输出,查看源码会发现异常简单
常量:
- INFO
- WARNING
- ERROR
public static function log($str, $level = 'INFO')
{
echo '[' . Carbon::now()->toDateTimeString() . ']' . "[{$level}] " . $str . PHP_EOL;
}
Console::log('警告!', Console::WARNING);
Console::debug($str)用于输出debug,仅在debug => true 时输出
Http提供了一个全局方法http()去获取Http单例实例
http()->get($url, array $query = []) 异步get方法
http()->post($url, array $query = [], $array = false) 异步post方法,第三个参数为是否自动json_decode()
http()->json($url, array $query = [], $array = false) 异步post方法,设置header为json请求,第三个参数为是否自动json_decode()
http()->request($url, $method = 'GET', array $query = []) 异步请求
此类将下载文件到初始化所设置的目录当中
FileManager::download($name, $data, $path) 下载文件到配置目录中, $name 为文件名, $data 为下载数据,$path为下载路径,位于tmp目录下(例:$path = mypath, /path/to/tmp/mypath)
此类用于一些系统处理方法
System::isWin():bool 返回当前运行系统是否Windows
System::getPath() 获取当前账号的保存文件路径