PHP for iPhone Native
Can I 开发者_高级运维compile PHP to a native iPhone app?
No. You can, though, make web apps that look an awful lot like they're iPhone apps.
Take a look at Titanium Mobile.
I've used their desktop developer, which can use PHP but not the mobile version
Perhaps a bit of elaboration. You cannot "compile" PHP. It is a scripting language. Yes you can compress, obfuscate, and even turn it into an Apache Module etc. but it is an interpreted language so at some point will need the/a php interpreter and a web server. So to get it to run on any hardware platform mean having the php engine and/or an Apache server to be there.
So to make any self contained app you need to have a programming language that will compile and produce an executable file that is supported on the target hardware or is self supporting. But essentially produces a bundle containing all the resources required to run that app whether it is an iPhone, Palm Pre, Mac or PC. For the iPhone Objective-c is used to program, connect to the libraries and frameworks and produce the required bundle to install on the iPhone. You can use Mono via Monotouch to do the development work but it then compiles to the required bundle for installation.
If you want to use PHP then build a web based app that will be accessible via Mobile Safari on the iPhone. To make the app render well you will need quite a bit of HTML, JavaScript and CSS but as has been mentioned there are frameworks to ease this pain such as iUi, iWebkit, jQTouch etc.
精彩评论