php 根据sdk重命名华为云obs临时访问 url

复制代码
public function getDownloadUrl($bucket,$path,$oldfilename){
$this->obsClient = new ObsClient([
    'key' => env('huawei.key'),
    'secret' => env('huawei.secreat'),
    'endpoint' => 'obs.cn-south-1.myhuaweicloud.com',//替换成自己的endpoint
]);
复制代码
$signedUrl = $this->obsClient->createSignedUrl(
    [
        'Method' => 'GET',
        'Bucket' => $bucket,
        'Key' => $path,
        'Expires' => 3600,
        'QueryParams' => [
            'response-content-disposition'=>'attachment;filename='.urlencode($oldfilename)
            ]
    ]
);
$signedUrl = $signedUrl['SignedUrl'];

}

相关推荐
Drifter_yh4 小时前
【黑马点评】Redisson 分布式锁核心原理剖析
java·数据库·redis·分布式·spring·缓存
莫寒清5 小时前
Spring MVC:@RequestParam 注解详解
java·spring·mvc
没有医保李先生6 小时前
字节对齐的总结
java·开发语言
甲枫叶8 小时前
【claude】Claude Code正式引入Git Worktree原生支持:Agent全面实现并行独立工作
java·人工智能·git·python·ai编程
六件套是我8 小时前
无法访问org.springframeword.beans.factory.annotation.Value
java·开发语言·spring boot
LYS_06188 小时前
C++学习(5)(函数 指针 引用)
java·c++·算法
forestsea8 小时前
Spring Cloud Alibaba 2025.1.0.0 正式发布:拥抱 Spring Boot 4.0 与 Java 21+ 的新时代
java·spring boot·后端
IT枫斗者8 小时前
IntelliJ IDEA 2025.3史诗级更新:统一发行版+Spring Boot 4支持,这更新太香了!
java·开发语言·前端·javascript·spring boot·后端·intellij-idea
forestsea8 小时前
Spring Boot 4.0 + JDK 25 + GraalVM:下一代云原生Java应用架构
java·spring boot·云原生