Skip to content

Commit c91090f

Browse files
committed
new fetch api
1 parent 4d35517 commit c91090f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/Qiniu/Storage/BucketManager.php

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,28 @@ public function changeMime($bucket, $key, $mime)
196196
* @param $bucket 目标资源空间
197197
* @param $key 目标资源文件名
198198
*
199-
* @return 成功返回NULL,失败返回对象{"error" => "<errMsg string>", ...}
199+
* @return array[] 包含已拉取的文件信息。
200+
* 成功时: [
201+
* [
202+
* "hash" => "<Hash string>",
203+
* "key" => "<Key string>"
204+
* ],
205+
* null
206+
* ]
207+
*
208+
* 失败时: [
209+
* null,
210+
* Qiniu/Http/Error
211+
* ]
200212
* @link http://developer.qiniu.com/docs/v6/api/reference/rs/fetch.html
201213
*/
202214
public function fetch($url, $bucket, $key)
203215
{
216+
204217
$resource = \Qiniu\base64_urlSafeEncode($url);
205218
$to = \Qiniu\entry($bucket, $key);
206219
$path = '/fetch/' . $resource . '/to/' . $to;
207-
list($_, $error) = $this->ioPost($path);
208-
return $error;
220+
return $this->ioPost($path);
209221
}
210222

211223
/**

0 commit comments

Comments
 (0)