public function copy($from_bucket, $from_key, $to_bucket, $to_key, $force = false)
{
$from = \Qiniu\entry($from_bucket, $from_key);
$to = \Qiniu\entry($to_bucket, $to_key);
$path = '/copy/' . $from . '/' . $to;
if ($force) {
$path .= '/force/true';
}
list(, $error) = $this->rsPost($path);
return $error;
}
/** * 复制文件到另外一个位置 * * @param $fromBucket * @param $fromFile * @param $toBucket * @param $toFile * @return \Qiniu\Storage\成功返回NULL|string */ public function copy($fromBucket, $fromFile, $toBucket, $toFile) { $bucketManager = new BucketManager($this->auth); $error = $bucketManager->copy($fromBucket, $fromFile, $toBucket, $toFile); if ($error !== null) { return $error; } else { return "Success"; } }