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