php - How do I simulate the default Bucket for local app engine launcher on localhost? -


on gae cloud platform can use through

file_put_contents('gs://#default#/hello.txt', 'hello'); 

or return bucket name

cloudstoragetools::getdefaultgooglestoragebucketname()  

how simulate cloud storage bucket in localhost app launcher?

the development server automatically simulate cloud storage using local file system. buckets don't need created first done automatically first time write them. difference on local development server cloudstoragetools::getdefaultgooglestoragebucketname() return string 'app_default_bucket' while in production default bucket name 'your-app-id.appspot.com', practical purposes makes no difference.

the following code work same way on both dev , prod:

// default bucket name $defaultbucket = cloudstoragetools::getdefaultgooglestoragebucketname();  // write default bucket file_put_contents('gs://' . $defaultbucket . '/some_file.txt', 'hello world');  // read file echo file_get_contents('gs://' . $defaultbucket . '/some_file.txt'); 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -