Needs to delete firebase db node using multiple keys array in php

白昼怎懂夜的黑 提交于 2020-06-27 05:30:41

问题


Firbase db structure is information->[key1=>[id=>1,value=>value1,status=>1],key2=>[id=>2,value=>value2,status=>1]...] I have array of keys (eg:key1,key3) needs to delete.That is delete node information->key(eg:info=>key1,info->key3).How can i write delete query using php? I tried using this code.

$deleteionKeys = [];
foreach ( $data as $key => $value ) {
    $deleteionKeys = array_merge( $deleteionKeys, ["{$key}" ] );
}
$firebase = new \FirebaseDB( "information" );
$data = $firebase->getChild($deleteionKeys);
$data->remove();

来源:https://stackoverflow.com/questions/62302397/needs-to-delete-firebase-db-node-using-multiple-keys-array-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!