哪个版本的 PHP 被视为“标准”?对于大多数网络主机?
我很惊讶地发现,当我的开发盒运行 5.3.x 时,我的许多托管站点仅支持 5.1.6。这是一个巨大的失望,因为我一直在使用命名空间(5.3+)和其他功能,在我看来,即使不是严格必要的,它们也非常出色。
无论如何,在编写可移植的代码(例如:WordPress 等流行平台的插件)时,我应该根据大多数 Web 主机支持的最低版本,选择哪个 PHP 版本。
有谁知道吗?怎样才能知道呢?
I have been surprised to learning that a number of my hosted sites only support 5.1.6, when my dev box is running 5.3.x. This is a huge disappointment, because I've been working with namespaces (5.3+) and other features that seem to me to be excellent, if not strictly necessary.
Anyway, when writing code that is designed to be portable (eg: plugins for popular platforms like WordPress), what version of PHP should I be targeting, based on the minimum version that's supported on the majority of web hosts out there.
Does anyone know? How can one find out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
检查
http://w3techs.com/technologies/details/ pl-php/all/all
出来。它包含大量 PHP 统计信息。 截至 2012 年 12 月 12 日,
96.4%
使用版本 5。42.3%
使用版本52.8%
使用版本 5.2Check
http://w3techs.com/technologies/details/pl-php/all/all
out.It contains a lot of PHP stats. As of 12 Dec 2012,
96.4%
of all the websites which use PHP.42.3%
of all the websites which use PHP version 552.8%
of all the websites which use PHP version 5我的 godaddy 托管帐户是 2017 年 2 月 5 日。如果您希望代码可移植,那么我会选择 5.0 功能的通用基线,这是相当大的功能集。
My godaddy hosting account is on 5.2.17. If you want code to be portable then I would go with a general baseline of 5.0 features, which is pretty big feature set.
当您为特定平台编写时,请检查该平台的系统要求。例如,Wordpress 3.1 支持 PHP 4.3 和 MySQL MySQL 4.1.2。下一个版本 3.2 会将其增加到 PHP 5.2.4 和 MySQL 5.0。因此,只需检查您想要为其编码的项目的相应网站即可。
When you write for a specific platform, check the system requirements of that platform. For example, Wordpress 3.1 supports PHP 4.3 and MySQL MySQL 4.1.2. The next version 3.2 will increase this to PHP 5.2.4 and MySQL 5.0. So just check the according website of the project you would like to code for.