我有以下Firebase数据库结构.uIds是一种类型List<String>.我正在尝试uIds使用递增的索引添加另一个uId .setValue()并updateChildren()要求我检索现有数据,push()并将添加一个项目,其中随机生成的字符串作为键而不是递增的索引.是否有一种更简单的方法不需要检索现有数据?谢谢!
"requests" : {
"request001" : {
"interests" : [ "x" ],
"live" : true,
"uIds" : [ "user1" ] // <---- from this
},
"request002" : {
"interests" : [ "y" ],
"live" : true,
"uIds" : [ "user2" ]
}
}
Run Code Online (Sandbox Code Playgroud)
编辑:
对不起,对不起.让我详细说明一下.假设我有上述数据库,并希望将其更新为以下内容.
"requests" : {
"-KSVYZwUQPfyosiyRVdr" : {
"interests" : [ "x" ],
"live" : true,
"uIds" : [ "user1", "user2" ] // …Run Code Online (Sandbox Code Playgroud) Hellloooooo ......我有两个<select>像这样的输入
<select id="sel1">
<option value="a">a</option>
<option value="b">b</option>
</select>
<select id="sel2">
//if 'a' is selected above,
//<option>apple</option>, <option>airplane</option>
//if 'b' is selected above,
//<option>banana</option>, <option>book</option>
</select>
Run Code Online (Sandbox Code Playgroud)
我想根据选择列出不同的选项集sel1.我可以使用onchange属性获取所选值,如下所示:
<select id="sel1" onchange="giveSelection(this)">
<script type="text/javascript">
function giveSelection(sel) {
var selected = sel.value;
}
</script>
Run Code Online (Sandbox Code Playgroud)
但是我无法想出一种方法来使用这个值来输出不同的选择选项sel2.请帮忙!
我有一个在节点中运行的js文件.这个js文件读取来自蓝牙设备的数据.我还有一个在apache服务器上运行的php文件.这会显示一个网站界面.
现在,在php文件中,我想使用js文件中的数据.有哪些方法可以实现这一目标?
对于Python中的标准库string template,是否有一个函数可以获取所有标识符的列表?
例如,使用以下 xml 文件:
<Text>Question ${PrimaryKey}:</Text>
<Text>Cheat: ${orientation}</Text>
Run Code Online (Sandbox Code Playgroud)
该函数将返回类似的内容PrimaryKey, orientation
android ×1
firebase ×1
forms ×1
html ×1
html-select ×1
javascript ×1
node.js ×1
php ×1
python ×1