暂无描述

cdn_timestamp_antileech.php 620B

123456789101112131415161718192021
  1. <?php
  2. require_once __DIR__ . '/../autoload.php';
  3. use Qiniu\Cdn\CdnManager;
  4. // 创建带时间戳防盗链的 URL
  5. // 参考文档:https://developer.qiniu.com/fusion/manual/3841/timestamp-hotlinking-prevention-fusion
  6. $encryptKey = 'your_domain_timestamp_antileech_encryptkey';
  7. // 一定要带访问协议,也就是 http:// 或者 https://
  8. $url1 = 'http://phpsdk.qiniuts.com/24.jpg?imageInfo';
  9. $url2 = 'http://phpsdk.qiniuts.com/24.jpg';
  10. // 有效期时间(单位秒)
  11. $durationInSeconds = 3600;
  12. $signedUrl = CdnManager::createTimestampAntiLeechUrl($url1, $encryptKey, $durationInSeconds);
  13. print($signedUrl);