【发布时间】:2013-12-18 13:58:30
【问题描述】:
我的问题如下,我有一个用 PHP 开发的应用程序,它允许通过 ajax 将图像上传到服务器,但现在我需要将图像的存储更改为谷歌云并从那里提供服务,为此,我创建了一个存储桶,并测试了以下不起作用的代码。
<?php
$options = [ "gs" => [ "Content-Type" => "text/plain" ]];
$ctx = stream_context_create($options);
file_put_contents("gs://myimages/hello.txt", "Hello", 0, $ctx);
?>
错误是这样的:file_put_contents(): Unable to find the wrapper "gs" - 你在配置 PHP 时忘记启用它了吗?在 C:\xampp\htdocs\upload1\gmail\index.php 第 4 行
但是我需要的只是将图像保存在谷歌云中,因为我的服务器将在另一个企业中运行,这可能吗?
以及如何启用gs://,
我试过这个http://php.net/manual/en/function.stream-context-set-default.php,但我不明白如何让它工作
【问题讨论】:
标签: image upload google-cloud-storage