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 按键修改电子时钟,C51单片机
  • ¥60 Java中实现如何实现张量类,并用于图像处理(不运用其他科学计算库和图像处理库))
  • ¥20 5037端口被adb自己占了
  • ¥15 python:excel数据写入多个对应word文档
  • ¥60 全一数分解素因子和素数循环节位数
  • ¥15 ffmpeg如何安装到虚拟环境
  • ¥188 寻找能做王者评分提取的
  • ¥15 matlab用simulink求解一个二阶微分方程,要求截图
  • ¥30 乘子法解约束最优化问题的matlab代码文件,最好有matlab代码文件
  • ¥15 写论文,需要数据支撑