Php 如何在localhost上模拟本地应用程序引擎启动器的默认存储桶?

Php 如何在localhost上模拟本地应用程序引擎启动器的默认存储桶?,php,google-app-engine,yii,Php,Google App Engine,Yii,在GAE云平台上,我可以通过 file_put_contents('gs://#default#/hello.txt', 'Hello'); 或者返回带有 CloudStorageTools::getDefaultGoogleStorageBucketName() 如何在localhost应用程序启动器中模拟云存储桶?开发服务器将使用本地文件系统自动模拟云存储。不需要首先创建bucket,因为这是在您第一次写入bucket时自动完成的。唯一的区别是,在本地开发服务器CloudStorage

在GAE云平台上,我可以通过

file_put_contents('gs://#default#/hello.txt', 'Hello');
或者返回带有

CloudStorageTools::getDefaultGoogleStorageBucketName() 

如何在localhost应用程序启动器中模拟云存储桶?

开发服务器将使用本地文件系统自动模拟云存储。不需要首先创建bucket,因为这是在您第一次写入bucket时自动完成的。唯一的区别是,在本地开发服务器CloudStorageTools::getDefaultGoogleStorageBucketName()上,将返回字符串“app_default_bucket”,而在生产中,默认的bucket名称通常是“your-app-id.appspot.com”,但出于实际目的,这没有什么区别

以下代码在dev和prod上的工作方式相同:

// Get default bucket name
$defaultBucket = CloudStorageTools::getDefaultGoogleStorageBucketName();

// Write something to the default bucket
file_put_contents('gs://' . $defaultBucket . '/some_file.txt', 'Hello World');

// Read something back from the file
echo file_get_contents('gs://' . $defaultBucket . '/some_file.txt');

在prod上,我尝试了这个方法,但我认为$defaultBucket不会返回任何结果。这是因为谷歌为每个应用引擎帐户提供默认存储吗?这是个好问题!在生产中,默认存储桶不会自动创建。要设置它,您仍然需要转到旧控制台->->->Administration->Application Settings->Cloud Integration(页面底部)。默认bucket“app\u default\u bucket”的用途是什么?如果我需要在本地启动应用程序之前将一些数据放在那里,我会怎么做?