PHP Class Google\Cloud\Datastore\Blob

Blobs can be used to store binary data in Google Cloud Datastore. Example: use Google\Cloud\ServiceBuilder; $cloud = new ServiceBuilder(); $datastore = $cloud->datastore(); $blob = $datastore->blob(file_get_contents(__DIR__ .'/family-photo.jpg')); Get the value of a blob by casting to a string. echo (string) $blob;
Afficher le fichier Open project: GoogleCloudPlatform/gcloud-php Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( string | resource | Psr\Http\Message\StreamInterface $value ) Create a blob
__toString ( ) : string Cast the blob to a string
get ( ) : Psr\Http\Message\StreamInterface Get the blob contents as a stream

Method Details

__construct() public méthode

Create a blob
public __construct ( string | resource | Psr\Http\Message\StreamInterface $value )
$value string | resource | Psr\Http\Message\StreamInterface The blob value

__toString() public méthode

Cast the blob to a string
public __toString ( ) : string
Résultat string

get() public méthode

Example: $value = $blob->get();
public get ( ) : Psr\Http\Message\StreamInterface
Résultat Psr\Http\Message\StreamInterface