php.ini(根据这种情况,文档不是必需的,但以防万一)google_app_engine.allow_include_gs_buckets = "#default#" index.php:file_put_contents("gs://#default#/hello.txt", "some text");并从Google App Engine中获取以下错误file_put_contents(): Unable to find the wrapper "gs" - did you forget to enable it when you configured PHP?据我从文档中可以看到,不需要其他配置,因为GAE会在其环境中自动注册文件流包装器.我想念什么?谢谢!解决方案因此,事实证明该文档适用于PHP 5环境而不适用于PHP 7(尽管未作说明).在PHP 7中实现此功能的方法记录在这里: https://github.com /GoogleCloudPlatform/php-docs-samples/tree/master/appengine/php72/storage/src我只是这样做:use Google\Cloud\Storage\StorageClient;function register_stream_wrapper($projectId) { $client = new StorageClient(['projectId' => $projectId]); $client->registerStreamWrapper();}register_stream_wrapper("projectId");注册包装器.I am writing some very simple code in the standard php73 Google App engine environment, following the documentation here: https://cloud.google.com/appengine/docs/standard/php/googlestorage/ and https://cloud.google.com/appengine/docs/standard/php/googlestorage/setupphp.ini (not required according to docs for this scenario, but just in case)google_app_engine.allow_include_gs_buckets = "#default#"index.php:file_put_contents("gs://#default#/hello.txt", "some text");and getting the following error from Google App Enginefile_put_contents(): Unable to find the wrapper "gs" - did you forget to enable it when you configured PHP?As far as I can see from the documentation there should be no other configuration required, as GAE registers the file stream wrapper automatically in their environment.What am I missing? Thanks! 解决方案 So it turns out the documentation is for the PHP 5 environment not PHP 7 (though that's not stated). The way to get this working in PHP 7 is documented here:https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/appengine/php72/storage/srcI just did this:use Google\Cloud\Storage\StorageClient;function register_stream_wrapper($projectId) { $client = new StorageClient(['projectId' => $projectId]); $client->registerStreamWrapper();}register_stream_wrapper("projectId");to register the wrapper. 这篇关于GAE PHP应用程序:无法找到包装"gs"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!