| @@ 226-233 (lines=8) @@ | ||
| 223 | * @return bool 创建成功返回 true,否则返回 false |
|
| 224 | * @throws \Exception |
|
| 225 | */ |
|
| 226 | public function createDir($path) |
|
| 227 | { |
|
| 228 | $path = rtrim($path, '/') . '/'; |
|
| 229 | $req = new Rest($this->config); |
|
| 230 | $res = $req->request('POST', $path) |
|
| 231 | ->withHeader('folder', 'true') |
|
| 232 | ->send(); |
|
| 233 | return $res->getStatusCode() === 200; |
|
| 234 | } |
|
| 235 | ||
| 236 | /** |
|
| @@ 256-264 (lines=9) @@ | ||
| 253 | * @return string 存储使用量,单位字节 |
|
| 254 | * @throws \Exception |
|
| 255 | */ |
|
| 256 | public function usage($path = '/') |
|
| 257 | { |
|
| 258 | $path = rtrim($path, '/') . '/'; |
|
| 259 | $req = new Rest($this->config); |
|
| 260 | $response = $req->request('GET', $path . '?usage') |
|
| 261 | ->send(); |
|
| 262 | ||
| 263 | return $response->getBody()->getContents(); |
|
| 264 | } |
|
| 265 | ||
| 266 | /** |
|
| 267 | * 刷新缓存 |
|