Qiniu\Storage\BucketManager::prefetch PHP Method

prefetch() public method

从镜像源站抓取资源到空间中,如果空间中已经存在,则覆盖该资源
public prefetch ( $bucket, $key ) : mixed
$bucket 待获取资源所在的空间
$key 代获取资源文件名
return mixed 成功返回NULL,失败返回对象Qiniu\Http\Error
    public function prefetch($bucket, $key)
    {
        $resource = \Qiniu\entry($bucket, $key);
        $path = '/prefetch/' . $resource;
        $ak = $this->auth->getAccessKey();
        $ioHost = $this->zone->getIoHost($ak, $bucket);
        $url = $ioHost . $path;
        list(, $error) = $this->post($url, null);
        return $error;
    }