rs_download_urls.php 430B

123456789101112131415161718
  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. // 构建Auth对象
  7. $auth = new Auth($accessKey, $secretKey);
  8. // 私有空间中的外链 http://<domain>/<file_key>
  9. $baseUrl = 'http://if-pri.qiniudn.com/qiniu.png?imageView2/1/h/500';
  10. // 对链接进行签名
  11. $signedUrl = $auth->privateDownloadUrl($baseUrl);
  12. echo $signedUrl;