创建一个可以离线工作,存储数据,然后在线时将其同步到远程MySQL的Web应用程序? [英] Creating a web app that can work offline, store data and then sync it to remote MySQL when online?

查看:73
本文介绍了创建一个可以离线工作,存储数据,然后在线时将其同步到远程MySQL的Web应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个用PHP/MySQL编写的Web应用程序.它将用于在附近走动的工作人员收集有关房屋的数据.可能在某些地方它们几乎没有细胞信号,所以我需要一种方法让他们离线时仍然查看Web应用程序,以及存储他们提交的数据,以便在手机一次插入后插入MySQL数据库.有信号/无线网络.

I am looking to create a web app written in PHP / MySQL. It will be used to collect data on houses by staff walking around a neighbourhood. There may be places where they have little to no cell signal, so I need a way to allow them to still view the web app when offline, as well as store the data they are submitting, to be inserted to the MySQL database once their phone has a signal / wi fi.

像这样甚至有可能吗?

推荐答案

是可以的.尽管有许多不同的选择,但渐进式Web应用"(PWA)是趋势之一今天的话题.他们通过响应式和移动网站提供移动应用程序体验.它们还提供独立模式.

Yes it is possible. Although there are many different alternatives, "Progressive Web Apps" (PWA) is one of the trending topic of today. They provide mobile app experience with responsive and mobile site. They also provide standalone mode.

您可以使用缓存API IndexedDB API

You can use Cache API, IndexedDB API, Web Storage API... to store data.

您需要 Service Worker API 才能同步您的应用程序数据库或在用户离线时管理您的应用程序.

You need Service Worker API to sync your application with database or to manage your application when the user is offline.

关于 PWA 的Google文档可能是一个不错的起点.另外,您还可以进入离线存储pwa Google文档.

Google's documentation about PWAs may be a good point to start. Also you can dive into offline storage for pwa docs of Google.

这是一个很好的博客,描述了 PWA .

This is a good blog to describe the features of PWAs.

2018年4月更新:

在IOS 11.3中,Safari 11.1在服务工作者的支持下发布.参考:文档

With IOS 11.3, Safari 11.1 was released with service worker support. Reference: the docs

感谢 @ChrisLove 对于 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆