Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/database/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
firebase在php中的实现:在firebase中查找令牌_Php_Database_Firebase - Fatal编程技术网

firebase在php中的实现:在firebase中查找令牌

firebase在php中的实现:在firebase中查找令牌,php,database,firebase,Php,Database,Firebase,我正在尝试用php实现firebase,下面是我找到的一个链接: 这就是一个例子 const DEFAULT_URL = 'https://kidsplace.firebaseio.com/'; const DEFAULT_TOKEN = 'MqL0c8tKCtheLSYcygYNtGhU8Z2hULOFs9OKPdEp'; const DEFAULT_PATH = '/firebase/example'; $firebase = new \Firebase\FirebaseLib(DEFAU

我正在尝试用php实现firebase,下面是我找到的一个链接:

这就是一个例子

const DEFAULT_URL = 'https://kidsplace.firebaseio.com/';
const DEFAULT_TOKEN = 'MqL0c8tKCtheLSYcygYNtGhU8Z2hULOFs9OKPdEp';
const DEFAULT_PATH = '/firebase/example';

$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);

// --- storing an array ---
$test = array(
    "foo" => "bar",
    "i_love" => "lamp",
    "id" => 42
);
$dateTime = new DateTime();
$firebase->set(DEFAULT_PATH . '/' . $dateTime->format('c'), $test);

// --- storing a string ---
$firebase->set(DEFAULT_PATH . '/name/contact001', "John Doe");

// --- reading the stored string ---
$name = $firebase->get(DEFAULT_PATH . '/name/contact001');
这是我对相同代码的版本:

<?php

include 'firebaseLib.php';

const DEFAULT_URL = "https://third-try-dae0a.firebaseio.com";
const DEFAULT_TOKEN = 'AIzaSyDeGfW4hnT3a6AXDevJMhb4Pi1eMWQ7yvc';
const DEFAULT_PATH = '/third-try-dae0a';


$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);

// --- storing an array ---
$test = array(
    "foo" => "bar",
    "i_love" => "lamp",
    "id" => 42
);
$dateTime = new DateTime();
$firebase->set(DEFAULT_PATH . '/' . $dateTime->format('c'), $test);

// --- storing a string ---
$firebase->set(DEFAULT_PATH . '/name/contact001', "John Doe");

// --- reading the stored string ---
$name = $firebase->get(DEFAULT_PATH . '/name/contact001');

echo "done";



 ?>
我的代码不起作用

我只想快速解释一下我在哪里找到默认的\u标记

那么默认路径呢?

1默认路径

默认路径是您的主项目路径。在firebase上创建新项目时。当你点击它时,你会得到它的路径。这就像:https://your_project_name-xxx.firebaseio.com

2DEFAULT\u令牌

从firebase控制台获取令牌的步骤

->登录open and open fire base console并选择project

->从设置图标转到项目设置

->从菜单中选择serviceaccounts

->从左菜单中选择databasesecrets

->将鼠标悬停在secret上,然后单击show按钮,您可以找到Firebase默认路径,如箭头所示。 默认情况下,它为空,因此代码如下所示:

const DEFAULT_PATH = '/null';
B.Desai描述的DFAULT_标记