php开发桌面应用程序_使用PHP开发跨平台桌面应用程序的3种方法

本文探讨了使用PHP开发跨平台桌面应用程序的可能性,包括Nightrain、WXPHP和TideSDK三种工具。虽然PHP不是首选的桌面应用开发语言,但在特定场景下,如简化语法和结构的需求,或是避免服务器成本,它可能是可行的选择。Nightrain依赖于PHP的内部服务器和无头浏览器,适合简单应用;WXPHP通过wxWidgets库提供多平台支持,需要学习曲线;而TideSDK基于WebKit,支持多种脚本语言,但PHP支持存在性能问题。虽然这些工具存在局限,但了解它们的存在可以帮助开发者在特定情况下做出决策。
摘要由CSDN通过智能技术生成

php开发桌面应用程序

PHP as a cross-platform desktop app development language? Blasphemy! Nonetheless, it’s possible.

PHP作为跨平台的桌面应用程序开发语言? 亵渎! 尽管如此,还是有可能的。

A few years ago, everything those interested in bringing PHP to the desktop had had was the now long abandoned GTK PHP. Since then, new players have appeared, though let’s first answer the “why”.

几年前,那些有兴趣将PHP引入桌面的人所拥有的,就是已经废弃了很长时间的GTK PHP 。 从那以后,新玩家出现了,尽管我们首先回答“为什么”。

为什么? (Why?)

Whyyyy_461298_679209

Why would anyone develop cross platform PHP apps for the desktop? Why not opt for something that can actually tie into the low level APIs of the operating system, like Adobe AIR? Why not go with something outdated and bloated but reliable, like Java? Why not make it a Chrome app and if you need native support, use Native Client? Hell, if you want a scripting language, why not just go with Python? Everything goes, as long as we avoid having to bundle a server with the whole shebang, right?

为什么有人会为台式机开发跨平台PHP应用程序? 为什么不选择实际上可以与操作系统的低级API绑定的内容,例如Adobe AIR? 为什么不选择Java之类的过时,肿但可靠的东西呢? 为什么不将其配置为Chrome应用?如果您需要本机支持,请使用本机客户端? 天哪,如果您要使用脚本语言,为什么不只使用Python? 只要我们避免将服务器与整个服务器捆绑在一起,一切都会顺利进行,对吧?

Off the top of my head, I can think of several far fetched scenarios:

我脑海中浮现出一些牵强的场景:

  1. You need a good middle ground between easy syntax and good structure, which is PHP, and you can’t be bothered to learn new languages like ActionScript

    您需要在简单的语法和良好的结构之间找到良好的中间立场,这就是PHP,并且您也不必费心学习ActionScript之类的新语言。
  2. You’re running IT in a company with highly computer illiterate people, and the only way to force them into using a good browser for your company app is to embed it into the app you deliver. It’s still a web app, but opens in a headless Chrome!

    您在一家计算机知识渊博的公司中运行IT,迫使他们为公司应用程序使用好的浏览器的唯一方法是将其嵌入到您提供的应用程序中。 它仍然是一个网络应用程序,但是可以在无头Chrome中打开!
  3. You want to avoid paying hosting costs for your own personal application, and you like to carry it with you on a USB stick. You just plug it in, run it, and your app is there – using the same SQLite DB from before. If you need to sync online, you send the whole DB export to Dropbox or some such service at the click of a button, thus making sure you’re literally the only one who can access your “web app” even without your computer.

    您希望避免为自己的个人应用程序支付托管费用,并且希望将其随身携带在USB记忆棒上。 您只需插入它,运行它,然后您的应用程序就在这里–使用以前的相同SQLite DB。 如果您需要在线同步,只需单击一下按钮,即可将整个数据库导出发送到Dropbox或某些此类服务,从而确保您实际上是即使没有计算机也可以访问“ Web应用程序”的人。
  4. You don’t need low level OS API access – you just want to make a browser based game, or a helper app, or something similarly simple. PHP is perfectly fine for that, and you already know the language.

    您不需要低级的OS API访问权限–您只想制作一个基于浏览器的游戏,一个助手应用程序或类似的简单应用。 PHP完全可以做到这一点,并且您已经知道该语言。

These scenarios might look like grasping at straws, and indeed, I really can’t think of a REAL, practical reason to want to do it that doesn’t have a viable alternative. Still, it’s nice to know it’s possible. Let’s see how.

这些场景可能看起来像是在吸管,但实际上,我真的想不出一个真正可行的理由来做,但没有可行的选择。 不过,很高兴知道这是可能的。 让我们看看如何。

1.夜雨 (1. Nightrain)

Nightrain is a pre-packaged set of PHP-hosting prerequisites powered by PHP 5.5.x at the moment. It’s a packager written in Python that uses PHP’s internal server to host your app, thus avoiding Apache and Nginx and minimizing configuration shenanigans. However, this also means some more advanced aspects are unavailable, and you can only really use it

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值