PHP:可以将Web应用程序编译成Windows应用程序吗?
我开发了一个 PHP Web 应用程序,但客户坚持使用真正的 Windows 应用程序,因为他不喜欢在浏览器中运行该软件。
是否有任何解决方案,是否有任何编译器可以将 Web 项目转换为 Windows exe?
我看过 Phc-Win ,但这似乎更适合小型命令行实用程序,而不适合整个网络应用程序...
更新:
我自己刚刚发现了这个,两者看起来很有希望...
I have developed a PHP web application, but a client insists on a real Windows application, since he doesn't like running the software inside a browser.
Are there any solutions for this, any compilers to turn a web project into a Windows exe ?
I have looked at Phc-Win , but that seems more suited for small command line utils, not for entire web-applications...
UPDATE:
just found this myself, both look quite promising...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
没有任何工具可以实现这一点,除了一个将浏览器嵌入到正常应用程序窗口中的简单包装应用程序之外。您的 PHP 应用程序必须完全重写,以包含构建 GUI 所需的所有开销代码 - 基本上浏览器自动执行的所有“显示”内容都必须添加到您的应用程序中。
There's no tool for this, short of a simple wrapper app that embeds a browser inside an otherwise normal application window. Your PHP app would have to be completely re-written to include ALL of the overhead code necessary to build a GUI - basically all the 'display' stuff that a browser does automatically, would have to added to your app.
好吧,你们中的一些人在谷歌上搜索得不够好:
http://www. appcelerator.com/products/titanium-cross-platform-application-development/
支持大多数“网络语言”来编写本机应用程序。
Appcelerator 教程参考:http://appceleratortitanium.com/tutorials/3- appcelerator-titanium-tutorial-beginners.html
引用:
不完全是您正在寻找的内容: http://www.roadsend.co/home /index.php?pageID=compiler
您可以查看“HipHop”(由 Facebook 制作):Converts PHP to compileable C++-
Well some of you did not google good enough:
http://www.appcelerator.com/products/titanium-cross-platform-application-development/
Supports most of the "web-languages" to write native Applications.
Tutorial Reference for Appcelerator: http://appceleratortitanium.com/tutorials/3-appcelerator-titanium-tutorial-beginners.html
Quote:
Not exactly what you are looking for: http://www.roadsend.co/home/index.php?pageID=compiler
You may look into "HipHop" (made by Facebook): Converts PHP to compileable C++-
有一个工具可以做到这一点。 :-) 我从未使用过它,但你可以尝试一下:Winbinder。
There's a tool for this. :-) I never used it but you can try this: Winbinder.
将 PHP 源代码编译为可执行文件非常简单。 Facebook 在 2010 年初发布了一个 PHP 编译器,名为 HipHop,旨在创建C++。然后,您可以将此代码编译为机器代码,例如使用 gcc。
对于像您这样的复杂 Web 应用程序来说,更困难的一点是用户界面。当按照我上面描述的方式编译时,应用程序可以从命令行运行 - 这可能适用于简单的任务,但如果您的应用程序返回 HTML,则不行。
解决此问题的一种可能性是 PHP-GTK。 PHP-GTK 是 GTK(Linux Ubuntu 默认使用的图形用户界面)的 API,用 PHP 编写。使用此解决方案必须阅读有关此 API 的一些文档,并且您需要重写程序的某些部分,但这可能是最漂亮的解决方案,因为它将创建“本机”体验。
另一种可能的解决方案可能涉及 Adobe AIR,它允许您使用 HTML 创建桌面程序, CSS 和 JavaScript,但我不知道这是否以及如何与您编译的 PHP 一起工作。
另请注意,并非绝对需要编译 PHP 才能在客户端计算机上运行。您还可以将 PHP 解释器与您的(未编译的)PHP 脚本一起提供。当然,编译带来了好处,例如程序执行速度更快。
-- 安德烈
It is simple to compile your PHP source code into an executable. Facebook released a compiler for PHP in early-2010, called HipHop, which aims to create C++. You could then compile this code, for example using gcc, to machine-code.
The more difficult point for a complex Web-App like yours is the user interface. When compiling the way I described above, the application can be run from command line - this might work for simple tasks, but not, if your application returns HTML.
One possibility to solve this problem is PHP-GTK. PHP-GTK is a API for GTK (the graphical user interface used by Linux Ubuntu by default), written in PHP. Using this solution would have to read some documentation about this API, and you would need to rewrite some parts of your program, but it would probably be the most beautiful solution, because it would create a "native" experience.
Another possible solution could involve Adobe AIR, which lets your create programs for the desktop, using HTML, CSS and JavaScript, but I don't know if and how this would work together with your compiled PHP.
Please also note that it isn't absolutely necessary to compile your PHP for it to run on the client's computer; You could also ship the PHP-interperter right with your (uncompiled) PHP-script. Of course, compiling brings benefits, such as faster execution of the program.
-- André