dongwu4834 2015-08-23 01:36
浏览 64

通过Google App Engine PHP在Google云端存储上设置所有者ACL

When I create objects in Google Cloud Storage from a PHP Google App Engine instance, the ACL for owner doesn't get set, making it impossible to change things like cache control headers later on.

$options = ['gs' => ['acl' => 'public-read', 'Content-Type' => 'text/plain']];
$ctx = stream_context_create($options);
file_put_contents('gs://my_bucket/file.yadda');

How would I set a more detailed ACL setting, from PHP app engine, instead of using one of the predefined cloud storage ACL magic settings (public-read, owner-full-read-write, etc....)?

  • 写回答

1条回答 默认 最新

  • duanlijia5864 2015-08-24 18:08
    关注

    The simplest way would be to use the setup on default ACL for a bucket to make the default ACL on the bucket be what you want. At that point, anything created without an ACL declared will go to your default.

    You don't even need to run anything in PHP to get that done. You just use your same code as now, don't specify an ACL, and you use gsutil to customize the default ACL with commands like :

    gsutil defacl ch -u my-email@gmail.com:OWNER gs://«my_bucket»
    

    More information here

    评论

报告相同问题?

悬赏问题

  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计