IMB*_*IMB 5 php amazon-s3 amazon-web-services
这是生成URL并更改其下载名称的正确方法吗?
$s3 = new AmazonS3();
$opt = array('response' => array('Content-Disposition' => 'attachment; "filename=newname.txt"'));
$url = $s3->get_object_url('bucket', 'file.txt', '5 minutes', $opt));
Run Code Online (Sandbox Code Playgroud)
显然不适合我.
经过多次测试后,显然get_object_url要求Content-Disposition参数为小写.
请注意,对于不区分大小写的create_object,情况并非如此.
所以上面的工作代码是:
$opt = array('response' => array('content-disposition' => 'attachment; "filename=newname.txt"'));
Run Code Online (Sandbox Code Playgroud)