如何连接到mysql数据库在phonegap [英] How to connect to mysql database in phonegap
问题描述
任何人都可以告诉我一个例子,如何连接到phonegap中的mysql数据库,或者如果它可能?
Can anyone show me an example of how to connect to mysql database in phonegap or if its even possible ?
推荐答案
同意cgwyllie你应该写一个webservice,将作为一个API到您的数据库与方法返回JSON(或XML)。
I agree with cgwyllie you should write a webservice which will act as an API to your database with methods returning JSON (or XML).
然后可以从您的PhoneGap项目中调用webservice方法(我建议查看jquery ajax api http://api.jquery.com/jQuery.ajax/ )。
The webservice methods can then be called from your PhoneGap project (I would recommend having a look at the jquery ajax api http://api.jquery.com/jQuery.ajax/).
我只需用PHP或任何你熟悉的语言编写webservice。
I would just write the webservice in PHP or whatever language you are familiar with.
这篇关于如何连接到mysql数据库在phonegap的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!