rs_copy.php 573 B

12345678910111213141516171819202122
  1. <?php
  2. require_once __DIR__ . '/../autoload.php';
  3. use \Qiniu\Auth;
  4. $accessKey = getenv('QINIU_ACCESS_KEY');
  5. $secretKey = getenv('QINIU_SECRET_KEY');
  6. $bucket = getenv('QINIU_TEST_BUCKET');
  7. $key = "qiniu.mp4";
  8. $auth = new Auth($accessKey, $secretKey);
  9. $config = new \Qiniu\Config();
  10. $bucketManager = new \Qiniu\Storage\BucketManager($auth, $config);
  11. $srcBucket = $bucket;
  12. $destBucket = $bucket;
  13. $srcKey = $key;
  14. $destKey = $key . "_copy";
  15. $err = $bucketManager->copy($srcBucket, $srcKey, $destBucket, $destKey, true);
  16. if ($err) {
  17. print_r($err);
  18. }