简体   繁体   English

获取 Google Cloud DataStore 和 PHP 中新实体的密钥

[英]Get the key of a new Entity in Google Cloud DataStore and PHP

In the documentation of DataStore this example is mentioned:在 DataStore 的文档中提到了这个例子:

$task = $datastore->entity('Task', [
    'category' => 'Personal',
    'done' => false,
    'priority' => 4,
    'description' => 'Learn Cloud Datastore'
]);
$datastore->insert($task);

I would like to get the key of this new entity that has just been inserted.我想获取刚刚插入的这个新实体的密钥。

You may use a statement similar to: {const taskKey = datastore.key('Task');}您可以使用类似于以下的语句:{const taskKey = datastore.key('Task');}

More detail is to be found in the Retrieving an entity sub-chapter.更多细节可以在检索实体子章节中找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM