@@ 257-265 (lines=9) @@ | ||
254 | * @return bool 创建成功返回 true,否则返回 false |
|
255 | * @throws \Exception |
|
256 | */ |
|
257 | public function createDir($path) |
|
258 | { |
|
259 | $path = rtrim($path, '/') . '/'; |
|
260 | $req = new Rest($this->config); |
|
261 | $res = $req->request('POST', $path) |
|
262 | ->withHeader('folder', 'true') |
|
263 | ->send(); |
|
264 | return $res->getStatusCode() === 200; |
|
265 | } |
|
266 | ||
267 | /** |
|
268 | * 删除文件或者目录 |
|
@@ 287-295 (lines=9) @@ | ||
284 | * @return string 存储使用量,单位字节 |
|
285 | * @throws \Exception |
|
286 | */ |
|
287 | public function usage($path = '/') |
|
288 | { |
|
289 | $path = rtrim($path, '/') . '/'; |
|
290 | $req = new Rest($this->config); |
|
291 | $response = $req->request('GET', $path . '?usage') |
|
292 | ->send(); |
|
293 | ||
294 | return $response->getBody()->getContents(); |
|
295 | } |
|
296 | ||
297 | /** |
|
298 | * 复制文件。只能操作文件,不能操作文件夹。 |