问题
I want to connect firebase database with my codeigniter project in php.
I not able to find the exact solution and library..
Please recommend the correct library with correct steps that I should follow to connect.
Thanks in advance.
回答1:
You can use FireBase in your project by using https://github.com/eelkevdbos/firebase-php
use Firebase\Firebase;
$fb = Firebase::initialize(YOUR_FIREBASE_URL, YOUR_FIREBASE_SECRET);
//or set your own implementation of the ClientInterface as second parameter of the regular constructor
$fb = new Firebase([ 'base_url' => YOUR_FIREBASE_BASE_URL, 'token' => YOUR_FIREBASE_SECRET ], new GuzzleHttp\Client());
//retrieve a node
$nodeGetContent = $fb->get('/node/path');
//set the content of a node
$nodeSetContent = $fb->set('/node/path', array('data' => 'toset'));
//update the content of a node
$nodeUpdateContent = $fb->update('/node/path', array('data' => 'toupdate'));
//delete a node
$nodeDeleteContent = $fb->delete('/node/path');
//push a new item to a node
$nodePushContent = $fb->push('/node/path', array('name' => 'item on list'));
来源:https://stackoverflow.com/questions/39136746/firebase-connection-with-codeigniter-in-php