doufu6130 2016-09-16 02:58
浏览 92

使用Firebase和PHP脚本

I've always written my web services from scratch (PHP + MySQL). Firebase has caught my attention for its apparent ease of use and speed of development. Before I started integrating it into my app, I had already written some PHP scripts which query a public API and return the results to my app. I'm thinking it would be cool if I could use Firebase to cache these results by adding them to the NoSQL DB, but I'm not totally clear on how I would do this. Can I host my scripts somewhere in Firebase? If not, I guess I just grab one of the open source SDKs off Github, but it seems like hosting scripts outside of the service isn't the ideal workflow. Maybe there is a way to call an external API and parse the results with Firebase itself?

  • 写回答

2条回答 默认 最新

  • doudou3213 2016-09-16 13:52
    关注

    No, Firebase can't run your code, but what you have in mind is a perfectly legitimate workflow. You can move the bulk of your non-sensitive business logic to the front end, while running some secret sauce on a server.

    The way to think of it is that your server is just another client to Firebase, it just has extra privileges and duties.

    Read this blog post. Your use case sounds like Pattern 2: Firebase-powered app with server code, which they partly explain as:

    In some cases it’s not possible to get away with only client code. Let’s look at a few examples:

    • You want your app to integrate with third party APIs (like Twilio to send an SMS, or SendGrid to send an email).
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作