douxi4414 2014-09-16 14:24
浏览 70
已采纳

在s3 php sdk中为putObject设置expiration

This is working codes for creating bucket and putObject:

$bucket = uniqid("php-sdk-sample-", true);
echo "Creating bucket named {$bucket}
";
$result = $client->createBucket(array(
'Bucket' => $bucket
));
// Wait until the bucket is created
$key = 'hello_world.txt';
echo "Creating a new object with key {$key}
";
$result = $client->createObject(array(
'Bucket' => $bucket,
'Key'    => $key,
'Body'   => "Hello World!" 
));

How can I set up expiration date for this just created object ? For ex. I want to see disappear the uploaded file 3 days later.

  • 写回答

2条回答 默认 最新

  • dongqian8265 2014-09-16 18:52
    关注

    You need to read and learn about S3 object lifecycle management first, then you can use the putBucketLifecycle operation to configure it.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 目详情-五一模拟赛详情页
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line