使用 php 按 UUID 更新 firebase 中的记录

Update records in firebase using php by UUID

我是 firebase 的新手,我想使用 PHP 通过 UUID 更新单个记录,我已经检查并尝试了 google 上可用的许多解决方案,但没有找到任何解决方案可以满足我的需求要求,附上我要更新 -LRphnkdvcEN5cIKkbDs UUID 数据的集合的屏幕截图。下面是我的代码

更新代码

public function update(array $data){
    if(empty($data) || !isset($data)){
        return FALSE;
    }
    else{
        $reference = $this->database->getReference($this->dbname)->orderByChild('id')->equalTo($data['record_id'])->update($data);
        return TRUE;
    }
}

如果您知道要更新的节点的键,则不需要查询。您可以只构建节点的路径,然后调用 update

$reference = $this->database->getReference($this->dbname."/".$data['record_id'])->update($data);

或者

$reference = $this->database->getReference($this->dbname).getChild($data['record_id'])->update($data);