cdcchen / upyun-client
upyun api client
1.1.5
2016-04-27 22:05 UTC
Requires
- php: >=5.4.0
- cdcchen/curl-client: ^1.0.0
This package is not auto-updated.
Last update: 2024-12-17 21:35:48 UTC
README
安装
composer require cdcchen/upyun-client:^1.0.0
文件操作使用教程
实例化 UpYunClient
use cdcchen\upyun\UpYunClient; $bucketName = ''; $username = ''; $password = ''; $client = new UpYunClient($bucketName, $username, $password);
上传文件
try { $result = $client->writeFile($distFile, $srcFile); print_r($result); } catch (\cdcchen\upyun\ResponseException $e) { echo $e->getMessage(), $e->getCode(), PHP_EOL; } catch (Exception $e) { echo $e->getCode(), $e->getMessage(), PHP_EOL; }
读取文件
$data = $client->readFile($file);
删除文件
$data = $client->deleteFile($file);
获取文件信息
$data = $client->getFileInfo($file);
创建目录
$result = $client->createDir($path, $mkdir = true);
删除目录
$result = $client->deleteDir($path);
读取目录
$data = $client->readDir($path);
获取bucknet存储使用量
$data = $client->getBucketUsage();
Url 作图接口
$delimiter = '!'; $maker = new UrlImageMaker($url, $delimiter); $maker->fw(200)->scale(2); $url = $maker->getUrl();
所有url做图接口方法直接使用又拍云官方文档对应的作图参数名称。