rs_change_mime.php 471B

123456789101112131415161718192021
  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. $newMime = 'video/x-mp4';
  9. $auth = new Auth($accessKey, $secretKey);
  10. $config = new \Qiniu\Config();
  11. $bucketManager = new \Qiniu\Storage\BucketManager($auth, $config);
  12. $err = $bucketManager->changeMime($bucket, $key, $newMime);
  13. if ($err) {
  14. print_r($err);
  15. }