如何从firebase获取并将值传递给变量

问题描述 投票:-1回答:1

我想从firebase / json中获取一个值并将其放在这些变量上。我只是想操纵这些变量。

var data1 = "";
var data2 = "";
var data3 = "";
var data4 = "";
var data5 = "";
var data6 = "";
var url = [
  {
    "videourl": data1,
  },
  {
    "videourl": data2,
  },
  {
    "videourl": data3,
  },
  {
    "videourl": data4,
  },
  {
    "videourl": data5,
  },
  {
    "videourl": data6,
  },
];
json firebase url const react-native-android
1个回答
-1
投票

这不是一个完整的答案,只是一部分任务,将在一段时间后发布下一步

Firebase Official Documentation

// Import Admin SDK
var admin = require("firebase-admin");

// Get a database reference to our posts
var db = admin.database();
var ref = db.ref("server/saving-data/fireblog/posts");

// Attach an asynchronous callback to read the data at our posts reference
ref.on("value", function(snapshot) {
  console.log(snapshot.val());

  //Check what you get here in the console.
}, function (errorObject) {
  console.log("The read failed: " + errorObject.code);
});
© www.soinside.com 2019 - 2024. All rights reserved.