使用Laravel 5将元数据,标头(Expires,CacheControl)添加到上传到Alicloud OSS的文件中

时间:2019-01-29 12:43:33

标签: php laravel amazon-web-services amazon-s3 object-storage

我试图找出如何添加元数据或标头(Expires,CacheControl等)。我想要具有标头的全局默认值,这在Laravel 5和S3 Amazon中有效,仅更改config / filesystems.php文件即可:

's3' => [
   'driver' => 's3',
   'key' => env('AWS_KEY'),
   'secret' => env('AWS_SECRET'),
   'region' => env('AWS_REGION'),
   'bucket' => env('AWS_BUCKET'),
   'source' => env('S3_SOURCE'),
   'options' => ['CacheControl' => 'max-age=604800, public', 'Expires' => gmdate('D, d M Y H:i:s \G\M\T', strtotime('+7 day'))]
]

'oss' => [
   'driver' => 'oss',
   'key' => env('OSS_ACCESS_KEY_ID'),
   'secret' => env('OSS_ACCESS_KEY_SECRET'),
   'endpoint' => env('OSS_ENDPOINT'),
   'bucket' => env('OSS_BUCKET'),
   'region' => env('OSS_REGION'),
   'source' => env('OSS_SOURCE')
   'options' => ['CacheControl' => 'max-age=604800, public', 'Expires' => gmdate('D, d M Y H:i:s \G\M\T', strtotime('+7 day'))]
]

此代码在Alicloud OSS(对象存储服务)中不起作用

0 个答案:

没有答案