将PHP网站转换为Phonegap应用程序 [英] Convert PHP website to Phonegap application

查看:191
本文介绍了将PHP网站转换为Phonegap应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将PHP Web应用程序转换为phonegap android应用程序。

/phonegap.com/about/faq/rel =nofollow> Phonegap常见问题




Q:CAN您使用PHONEGAP使用PHP / ASP / JSF / JAVA / .NET?



A:PhoneGap应用程序只能使用HTML,CSS和JavaScript。但是,您可以使用网络协议(XmlHTTPRequest,Web套接字等)轻松地与以任何语言编写的后端服务进行通信。这允许您的PhoneGap应用程序在设备连接到互联网时远程访问现有的业务流程。





  1. 要将PHP页面转换为HTML页面,请删除对PHP和服务器的所有引用。

  2. *占位符* 插入到您想要的网页上的那些位置

  3. 将支持的PHP系统转换或复制到 REST API 系统。

  4. 使用JQuery或等同于(XmlHTTPRequest,Web Sockets等)与后端服务进行通信。

  5. 将服务器响应(通过JQuery)插入 *占位符*

:最佳做法是在手机上存储所有assest(javascript,css,字体,图片等)。您还可以使用storageLocal,SQLite或IndexedDB本地存储一些数据。服务器服务属于服务器 - 最佳做法是不直接与SQL服务器通信。 (但是很多人通过在互联网上通过SQL语言来做这个危险的方式 - 而不是最佳实践。)



有问题吗?请在一个approriate论坛。这里是列表。我推荐 Google Group of Cordova / Phonegap


Is it possible to convert a PHP web application to a phonegap android application. If yes, what will be the easiest method for doing it..?

解决方案

From the Phonegap FAQ

Q: CAN YOU USE PHP/ASP/JSF/JAVA/.NET WITH PHONEGAP?

A: A PhoneGap application may only use HTML, CSS, and JavaScript. However, you can make use of network protocols (XmlHTTPRequest, Web Sockets, etc) to easily communicate with backend services written in any language. This allows your PhoneGap app to remotely access existing business processes while the device is connected to the Internet.

  1. To convert PHP pages to HTML pages, remove all references to PHP and the server. All services (including MYSQL) will be on the backend (via jquery or equivalent).
  2. Insert *placeholders* into those places on the webpage that you want to insert data.
  3. Convert, or replicate, your supporting PHP system into a REST API system.
  4. Use JQuery or equivalent to (XmlHTTPRequest, Web Sockets, etc) to communicate with backend services.
  5. Insert Server responses (via JQuery) into the *placeholders*.

NOTE: Best practice is to store all assest (javascript, css, fonts, images, etc.) on the mobile. You can also use storageLocal, SQLite, or IndexedDB to store some data locally. Server services belong on the server - it is best practice not to talk to the SQL server directly. (But many people do it the dangerous way by talking SQL over the Internet - not best practice.)

Any question? please ask at an approriate forum. Here is a list. I recommend Google Group of Cordova/Phonegap

这篇关于将PHP网站转换为Phonegap应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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