就在几个小时前,我确实有这个工作。不知道我做了什么把它搞砸了,如果有的话。我正在尝试将 file_put_contents() 用于我的临时目录中的 test.txt 文件来测试一些东西。我不能使用 print_r() 或 echo,因为有时它是我正在测试的 ajax 调用。我不断收到的错误是:
Warning: file_put_contents(temp/test.txt): The local filesystem is readonly, open failed in sub-dirs.../request.php on line 62
Warning: file_put_contents(temp/test.txt): failed to open stream: No such file or directory in sub-dirs.../request.php on line 62
我不在生产中。这是本地的,根据文档,这应该有效:
将数据存储在开发 Web 服务器中
Google App Engine for PHP 支持通过 PHP 的流 API 读取和写入 Google Cloud Storage。开发人员可以通过将对象指定为支持 PHP 流实现的任何 PHP 函数(例如 fopen()、fwrite() 或 get_file_contents())的 URI 来读取和写入 Google 云存储中的对象。
在开发服务器中,当指定 Google Cloud Storage URI 时,我们通过读取和写入用户本地文件系统上的临时文件来模拟此功能。这些文件在请求之间保留,允许您在将代码部署到 App Engine 之前在本地开发环境中测试功能。
在像 fopen() 这样的 PHP 开发服务器流式调用中,'gs://' url 上的 file_get_contents() 通过读取和写入本地文件系统来模拟。
我很沮丧,所以非常感谢任何帮助。会投票。