search
HomeBackend DevelopmentPHP TutorialPHP:风雨欲来路在何方?_PHP

PHP:风雨欲来路在何方?_PHP

Jun 01, 2016 pm 12:40 PM
javaphpCanusnetworkScriptlanguage

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的狭缝中生存并壮大,是一件很不容易的事情。

而PHP本身还有不少问题。像低层用户过多。大量的开发者处于入门阶段,不知道如何提高自己,导致大量开源代码不规范和低效率,而又会又下一批初学者从这些糟糕的代码中学习,如此递归。另一方面,高阶用户却因为PHP的面向对象特性不完整等原因而不得不转向其他语言以开发大型应用。


PHP5:浓浓咖啡味

PHP开发组在今年年中发布了PHP5的BETA1,我们可以从中看见PHP的反击。首先,PHP4的开发仍然马不停蹄,而且我们可以肯定,PHP4的开发还将持续很长一段时间。这样做的目的是巩固既有用户,同时在将来的PHP4版本中逐渐融合部分PHP5的新特性,实现PHP4到PHP5的平滑过渡。

再来看PHP5的变化。在PHP5中,我们看到了太多Java的影子。OO体系几乎是COPY的Java的,这保证了PHP高阶用户不流失,使得他们能方便的使用最新的技术体系来架构自己的应用。另一方面,也为Java程序员使用PHP提供了方便,虽然这样的情况可能比较少。在完善了OO体系后,PHP具备了真正进入企业级市场的能力。然后PHP5也添加了不少自己的东西,像__get,来使这个体系更易用。不知道的是,这杯cappuccino是否会像Java般受欢迎呢?

从PHP5的改变中,我们看出了PHP将来的方向。一是和JSP竞争,争取在某一些方面取代JSP,成为粘合JavaBeans和Servlet的胶水。这要求PHP和Java之间建立更为紧密的关系。Zend小组正在参与JSR规范的指定。这个规范将使得你可以在PHP中直接new一个Java对象并调用它的方法。这样也能使PHP更快的进入企业级市场。另外,如果PHP编写的脚本能被直接编译成Binary Code在Jvm上运行的话,PHP的前景会好很多。另一个方向是做Java和.net间的集成,在一些大型的应用中整合已有资源。PHP4中我们已经可以调用com组件和Java对象,相信在将来PHP5将对此提供更多的支持。

不管怎么样,无论是和J2ee和.net竞争还是融合,PHP要走的,将是一条满是荆棘的路。不过既然PHP已经一路风雨地走到了今天,我们有什么理由不相信它能走得更远呢?

Best Wishes, PHP.



PS 这只是Easy对PHP将来发展的一点个人看法,可能不是很成熟,只是给大家一点参考。

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
How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values ​​and handle functions that may return null values.

How does PHP handle object cloning (clone keyword) and the __clone magic method?How does PHP handle object cloning (clone keyword) and the __clone magic method?Apr 17, 2025 am 12:24 AM

In PHP, use the clone keyword to create a copy of the object and customize the cloning behavior through the \_\_clone magic method. 1. Use the clone keyword to make a shallow copy, cloning the object's properties but not the object's properties. 2. The \_\_clone method can deeply copy nested objects to avoid shallow copying problems. 3. Pay attention to avoid circular references and performance problems in cloning, and optimize cloning operations to improve efficiency.

PHP vs. Python: Use Cases and ApplicationsPHP vs. Python: Use Cases and ApplicationsApr 17, 2025 am 12:23 AM

PHP is suitable for web development and content management systems, and Python is suitable for data science, machine learning and automation scripts. 1.PHP performs well in building fast and scalable websites and applications and is commonly used in CMS such as WordPress. 2. Python has performed outstandingly in the fields of data science and machine learning, with rich libraries such as NumPy and TensorFlow.

Describe different HTTP caching headers (e.g., Cache-Control, ETag, Last-Modified).Describe different HTTP caching headers (e.g., Cache-Control, ETag, Last-Modified).Apr 17, 2025 am 12:22 AM

Key players in HTTP cache headers include Cache-Control, ETag, and Last-Modified. 1.Cache-Control is used to control caching policies. Example: Cache-Control:max-age=3600,public. 2. ETag verifies resource changes through unique identifiers, example: ETag: "686897696a7c876b7e". 3.Last-Modified indicates the resource's last modification time, example: Last-Modified:Wed,21Oct201507:28:00GMT.

Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1?Explain secure password hashing in PHP (e.g., password_hash, password_verify). Why not use MD5 or SHA1?Apr 17, 2025 am 12:06 AM

In PHP, password_hash and password_verify functions should be used to implement secure password hashing, and MD5 or SHA1 should not be used. 1) password_hash generates a hash containing salt values ​​to enhance security. 2) Password_verify verify password and ensure security by comparing hash values. 3) MD5 and SHA1 are vulnerable and lack salt values, and are not suitable for modern password security.

PHP: An Introduction to the Server-Side Scripting LanguagePHP: An Introduction to the Server-Side Scripting LanguageApr 16, 2025 am 12:18 AM

PHP is a server-side scripting language used for dynamic web development and server-side applications. 1.PHP is an interpreted language that does not require compilation and is suitable for rapid development. 2. PHP code is embedded in HTML, making it easy to develop web pages. 3. PHP processes server-side logic, generates HTML output, and supports user interaction and data processing. 4. PHP can interact with the database, process form submission, and execute server-side tasks.

PHP and the Web: Exploring its Long-Term ImpactPHP and the Web: Exploring its Long-Term ImpactApr 16, 2025 am 12:17 AM

PHP has shaped the network over the past few decades and will continue to play an important role in web development. 1) PHP originated in 1994 and has become the first choice for developers due to its ease of use and seamless integration with MySQL. 2) Its core functions include generating dynamic content and integrating with the database, allowing the website to be updated in real time and displayed in personalized manner. 3) The wide application and ecosystem of PHP have driven its long-term impact, but it also faces version updates and security challenges. 4) Performance improvements in recent years, such as the release of PHP7, enable it to compete with modern languages. 5) In the future, PHP needs to deal with new challenges such as containerization and microservices, but its flexibility and active community make it adaptable.

Why Use PHP? Advantages and Benefits ExplainedWhy Use PHP? Advantages and Benefits ExplainedApr 16, 2025 am 12:16 AM

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function