Geen omschrijving

upload_mgr_init.php 460B

1234567891011121314151617181920
  1. <?php
  2. require_once __DIR__ . '/../autoload.php';
  3. use Qiniu\Auth;
  4. use Qiniu\Storage\UploadManager;
  5. // 控制台获取密钥:https://portal.qiniu.com/user/key
  6. $accessKey = getenv('QINIU_ACCESS_KEY');
  7. $secretKey = getenv('QINIU_SECRET_KEY');
  8. $auth = new Auth($accessKey, $secretKey);
  9. // 存储空间名称
  10. $bucket = 'Bucket_Name';
  11. // 生成上传 Token
  12. $token = $auth->uploadToken($bucket);
  13. // 构建 UploadManager 对象
  14. $uploadMgr = new UploadManager();