php 如何将 MySql 数据库与 Firebase 连接?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37696408/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 01:20:24  来源:igfitidea点击:

How to connect MySql database with Firebase?

phpmysqlfirebasefirebase-realtime-database

提问by Nithin

How to connect MySql database with Firebase. This is for real time data updates and show it on browser. Already created Firebase account and got config code. Now I want connect my existing MySql based database with Firebase.

如何将 MySql 数据库与 Firebase 连接。这是用于实时数据更新并在浏览器上显示。已创建 Firebase 帐户并获得配置代码。现在我想将我现有的基于 MySql 的数据库与 Firebase 连接。

Please Help

请帮忙

Thanks

谢谢

回答by aero

This is something that I have been interested in recently as well.

这也是我最近很感兴趣的事情。

Here is a great article that should answer your question:

这是一篇很好的文章,应该可以回答您的问题:

https://firebase.googleblog.com/2013/03/where-does-firebase-fit-in-your-app.html

https://firebase.googleblog.com/2013/03/where-does-firebase-fit-in-your-app.html

"Pattern 2: Firebase-powered app with server code" can probably provide you with a solution to connect Firebase to your MySQL DB.

“模式 2:带有服务器代码的 Firebase 驱动的应用程序”可能会为您提供将 Firebase 连接到 MySQL 数据库的解决方案。

What you could do is have your PHP app send updates to your firebase db when ever something update-worthy happens in your MySQL database. If all your clients are then subscribing/watching the changes to your Firebase db, then you have (albeit indirectly) connected your MySQL database with your Firebase db.

您可以做的是让您的 PHP 应用程序在您的 MySQL 数据库中发生值得更新的事情时将更新发送到您的 firebase 数据库。如果您的所有客户都订阅/观看对 Firebase 数据库的更改,那么您已经(尽管是间接地)将 MySQL 数据库与 Firebase 数据库连接起来。

Hope this helps.

希望这可以帮助。

回答by DevMagician

You can store and retrieve Firebase data using REST API. Create the API in the same server as the Mysql database - this will work from any environment that lets you make HTTPS requests.

您可以使用 REST API 存储和检索 Firebase 数据。在与 Mysql 数据库相同的服务器中创建 API - 这将适用于任何允许您发出 HTTPS 请求的环境。