简体   繁体   English

如何使用PHP / MySQl Web服务器对iPhone Web App进行编码

[英]How to code iphone web app with PHP/MySQl web server

basically i have a site which made by php and mysql 基本上我有一个由php和mysql制作的网站

i wanna to develop a iphone webapp (non-native app) to interact with my new mobile site (php+mysql) 我想开发一个iPhone Webapp(非本地应用程序)与我的新移动网站进行交互(php + mysql)

im not sure how iphone webapp work, can it include the whole site directly?? 我不确定iphone webapp的工作方式,可以直接包含整个网站吗?

im quite worry about the connection with mysql database too 我也很担心与mysql数据库的连接

is it possible to do that? 有可能这样做吗?

can i develop the mobile site as normal web page? 我可以将移动网站开发为普通网页吗?

A "mobile web app" is just like any other web app. “移动Web应用程序”与其他任何Web应用程序一样。 There is no difference except that the way it looks is optimized for a smaller screen. 没什么区别,只是它的外观针对较小的屏幕进行了优化。 It's just a web page which means the PHP is running on the server (not the device). 这只是一个网页,这意味着PHP正在服务器(而不是设备)上运行。 The iPhone is able to run javascript and render CSS 3 which is nice because it makes it so you can make your website look and feel as if it were a native app that was downloaded and installed by the user. iPhone能够运行javascript并呈现CSS 3,这很不错,因为它使它成为现实,因此您可以使您的网站看起来像是由用户下载并安装的本机应用。

The iPhone even allows you to "save a web page to your home screen" which is essentially the same thing as saving a bookmark (nothing is actually downloaded or installed), but it adds the ability to create a full screen web app. iPhone甚至允许您“将网页保存到主屏幕”,这与保存书签(实际上没有下载或安装任何内容)基本相同,但是它增加了创建全屏Web应用程序的功能。

However, you may be talking more about creating a native application, built using web technologies. 但是,您可能正在谈论有关创建使用Web技术构建的本机应用程序的更多信息。 A native app is actually downloaded and installed on the device. 实际上,本机应用程序已下载并安装在设备上。 Native iPhone applications run Objective-C. 本机iPhone应用程序运行Objective-C。 They do not (and cannot) run PHP. 他们不(也不能)运行PHP。 You could write an iPhone app using Objective-C which uses a "web view" which pulls up your website by default, however, all you're doing is recreating the "save to home screen" app that I mentioned earlier. 您可以使用Objective-C编写一个iPhone应用程序,该应用程序使用默认情况下会拉起您网站的“网络视图”,但是,您要做的就是重新创建我前面提到的“保存到主屏幕”应用程序。 The only advantage is that you could potentially list it in the App Store. 唯一的好处是您可以将其列出在App Store中。

There is a better way to create a native app experience using web technologies... 有一种更好的方法可以使用网络技术来创建本机应用程序体验...

There are a number of libraries, tools, and companies that are popping up that address this very issue. 出现了许多库,工具和公司来解决此问题。

jQuery Mobile and Sencha Touch are both JavaScript frameworks for building web pages/ web apps that look good on a mobile device. jQuery Mobile和Sencha Touch都是JavaScript框架,用于构建在移动设备上看起来不错的网页/网络应用程序。

PhoneGap is a tool/framework to be able to take your HTML, CSS and JavaScript and package them up as a native app. PhoneGap是一种工具/框架,可以接收HTML,CSS和JavaScript并将其打包为本地应用程序。

Appcelerator Titanium is a framework that allows you to write JavaScript that you can compile into native UI components. Appcelerator Titanium是一个框架,允许您编写可编译为本机UI组件的JavaScript。

Whichever approach you choose is up to you and what you want to accomplish. 无论选择哪种方法,都取决于您自己以及您想要实现的目标。 The key to remember is that the PHP code only runs on the server. 要记住的关键是PHP代码仅在服务器上运行。 JavaScript is used to run code on the client. JavaScript用于在客户端上运行代码。 And if you were going to package your website up as native app, you will most likely include a lot of your HTML as static templates and use JavaScript to pull data from the server and populate your HTML templates. 而且,如果您打算将网站打包为本地应用程序,则很可能会将大量HTML包含为静态模板,并使用JavaScript从服务器提取数据并填充HTML模板。

I would recommend starting with jQuery Mobile. 我建议从jQuery Mobile开始。

You could use Iui to make a site that appeals to iPhones and iPads 您可以使用Iui制作一个吸引iPhone和iPad的网站

PHP Would be a great server-side for any iPhone app, but you should make sure that your client side has no security flaws. 对于任何iPhone应用程序,PHP都是很好的服务器端,但是您应确保客户端没有安全漏洞。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM