@@ 209-216 (lines=8) @@ | ||
206 | * @return bool 创建成功返回 true,否则返回 false |
|
207 | * @throws \Exception |
|
208 | */ |
|
209 | public function createDir($path) { |
|
210 | $path = rtrim($path, '/') . '/'; |
|
211 | $req = new Rest($this->config); |
|
212 | $res = $req->request('POST', $path) |
|
213 | ->withHeader('folder', 'true') |
|
214 | ->send(); |
|
215 | return $res->getStatusCode() === 200; |
|
216 | } |
|
217 | ||
218 | /** |
|
219 | * 删除文件或者目录 |
|
@@ 237-246 (lines=10) @@ | ||
234 | * @return string 存储使用量,单位字节 |
|
235 | * @throws \Exception |
|
236 | */ |
|
237 | public function usage($path = '/') { |
|
238 | ||
239 | $path = rtrim($path, '/') . '/'; |
|
240 | $req = new Rest($this->config); |
|
241 | $response = $req->request('GET', $path . '?usage') |
|
242 | ->withHeader('folder', 'true') |
|
243 | ->send(); |
|
244 | ||
245 | return $response->getBody()->getContents(); |
|
246 | } |
|
247 | ||
248 | /** |
|
249 | * 刷新缓存 |