Home  >  Article  >  Backend Development  >  PHP: The storm is coming, where is the road ahead?_PHP Tutorial

PHP: The storm is coming, where is the road ahead?_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 16:10:12902browse

PHP4:奇迹背后

1995年时,Rasmus在用PHP写他的个人主页;今天,PHP成为风靡全球的脚本语言,越来越多的站点选择使用PHP,连Yahoo都放弃了自己的脚本而改用PHP支持它的网站。可以说,PHP是一个奇迹。我一直认为,任何奇迹背后都有它的原因。现在,就让我们透过这个奇迹,来看看PHP的成功之道。

1 简单易用

PHP的入门门槛很低,它对使用者的要求微乎其微。学过C语言的人,使用PHP几乎不需要什么时间。它们的语法是如此相似,以至于我常常想,是不是在C语言变量前加个$就能改成PHP。这使得大量C程序员在网络脚本中选择了PHP。另外,比起ASP的组件系统和Java庞大的类库来,PHP的函数库要好学多了。在编程风格上,PHP更是自由,你可以使用N种风格来写你的脚本程序。这些特性使得PHP成为初学者的首选语言。抢占初学者市场是很重要的策略。如同任何人都会对自己的初恋记忆犹新一样,人们往往会对最初学习的语言有很深的感情。即使后来自己成长了,改用其他语言了,还是会时时记起最初学习的语言。在这点上,PHP做得很出色。

2 剪裁得当

PHP开发组是最了解网络的一群人,他们非常清楚用户要的是什么。PHP就是要做一个出色的网络脚本语言,而且,它只是要做一个网络脚本语言。PHP提供的函数集在网络方面相当强大,而且重点均专注于网络应用。像PHP中的无组件文件上传,超多数据库支持等特性都表现出这个特点。顺便说一句,PHP甚至支持ACCESS数据库。专注使得PHP在网络上表现出极其优秀的性能。有失才能有得。

3 支持强大

PHP有强大的OpenSource团体支持,在网络上有数以万计的开源代码。你可以整合几个现有程式来实现你的应用,也可以分析大师级的代码来得到提高。PHP还有很多扩展性的项目来增强PHP在某个方面的功能。像注重编程规范化和代码重用的PEAR,提供可编译模板技术的Smarty,甚至开发桌面程序的GTK。

分析完这几个理由,我们可以看出,PHP的成功得益于PHP开发组的战略眼光。PHP提供了一个最小工作集,使用户能用最简单的方式高效地完成自己需要的应用。这正是初学者需要的。然后它通过方便的扩展来提供各个方面的解决方案,这样,你只需要学你要用到的那个领域的东西。当你涉及的领域越来越多时,你的水平也随之提高,当你熟悉了大多领域时,回头看看,会发现不知不觉已到山腰。PHP也提供了我们一种学习态度。

ASP.net+J2EE:风雨欲来

网络脚本界的革新浪潮由Microsoft的ASP.net首先发起。在ASP.net中,有一个很吸引人的东西——事件驱动机制。这在桌面编程中是很普通的概念,而在脚本编程中事件驱动意味着对服务器端的脚本(如PHP、JSP、ASP)和客户端的脚本(如JavaScript和VbScript)进行封装,使之协同工作。这样一来,编程就会变得异常方便。在.net环境中的事件驱动还有一个优势,就是你甚至可以不会任何服务器端脚本和客户端脚本,因为在ASP.net中,是可以直接使用C#这样的语言的——连$都不用加。这为MS阵营的传统程序员转向网络开发铺平了道路,同时,也使PHP在初学者市场上受到很大的打击。可以预见,以后的传统程序员转向PHP的将大为减少。不过ASP.net最大的问题在于它只能在Windows上运行,而现在大陆正在大力发展Linux。这使得PHP的生存空间似乎宽了点,但是——让我们来看看Java吧。

Java也是一个奇迹,1995年发布第一个版本,现在形成三个版本,分别覆盖嵌入式系统(J2me)桌面程序(J2se)和服务器(J2ee)三大应用领域。更重要的是,Java得到了绝大多数程序员的认可,现在世界上最出色的计算机书籍多是以C++或者Java作为描述语言的。Java几乎像C一样,成为一种信仰。所以,我们不要妄想Java阵营的程序员会转向PHP。同时,在同是开源和跨平台的Java面前,PHP丢掉了不少优势。J2ee中的JSP又在初学者市场对PHP造成相当的压力。

在曾经使PHP成功的初学者市场、易用性和开源支持等方面都受到挑战,而随着机器性能的不断提高,大家对效率的要求渐渐降低的情况下,可以说,PHP要在ASP.net和J2EE的狭缝中生存并壮大,是一件很不容易的事情。

And PHP itself still has many problems. Like too many low-level users. A large number of developers are in the entry-level stage and do not know how to improve themselves, resulting in a large amount of irregular and inefficient open source code, and the next batch of beginners will learn from these bad codes, and so on recursively. On the other hand, advanced users have to turn to other languages ​​to develop large-scale applications due to PHP's incomplete object-oriented features and other reasons.


PHP5: Strong coffee flavor

The PHP development team released BETA1 of PHP5 in the middle of this year, from which we can see PHP’s counterattack. First of all, the development of PHP4 is still going on, and we can be sure that the development of PHP4 will continue for a long time. The purpose of this is to consolidate existing users, while gradually integrating some of the new features of PHP5 in future PHP4 versions to achieve a smooth transition from PHP4 to PHP5.

Let’s look at the changes in PHP5. In PHP5, we see too many shadows of Java. The OO system is almost a COPY of Java, which ensures that high-level PHP users will not be lost, allowing them to easily use the latest technology system to build their own applications. On the other hand, it also provides convenience for Java programmers to use PHP, although such cases may be relatively rare. After improving the OO system, PHP has the ability to truly enter the enterprise-level market. Then PHP5 also added a lot of its own things, such as __get, to make the system easier to use. What I don’t know is, will this cup of cappuccino be as popular as Java?

From the changes in PHP5, we can see the future direction of PHP. One is to compete with JSP and strive to replace JSP in some aspects and become the glue that binds JavaBeans and Servlets. This requires a closer relationship between PHP and Java. The Zend group is participating in the specification of the JSR. This specification will allow you to directly new a Java object and call its methods in PHP. This will also enable PHP to enter the enterprise market faster. In addition, if scripts written in PHP can be directly compiled into Binary Code and run on Jvm, PHP's prospects will be much better. Another direction is to integrate Java and .net and integrate existing resources in some large-scale applications. We can already call com components and Java objects in PHP4, and I believe PHP5 will provide more support for this in the future.

No matter what, whether it is competing with J2ee and .net or integrating with it, PHP will take a road full of thorns. But since PHP has come all the way to where it is today, what reason do we have not to believe that it can go further?

Best Wishes, PHP.

PS This is just Easy's personal opinion on the future development of PHP. It may not be very mature, but it is just for everyone's reference.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/314291.htmlTechArticlePHP4: Behind the Miracle In 1995, Rasmus was using PHP to write his personal homepage; today, PHP has become popular all over the world scripting language, more and more sites choose to use PHP, even Yahoo has given up on itself...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn