Php 简明教程
PHP - Introduction
PHP 最初是一个小型开源项目,随着越来越多的人发现其用处,它不断发展。Rasmus Lerdorf 早在 1994 年就发布了 PHP 的第一个版本。最初,PHP 被认为是“个人主页”的缩写,但现在它代表递归首字母缩略词“PHP:超文本预处理器”。
PHP started out as a small open source project that evolved as more and more people found out how useful it was. Rasmus Lerdorf released the first version of PHP way back in 1994. Initially, PHP was supposed to be an abbreviation for "Personal Home Page", but it now stands for the recursive initialism "PHP: Hypertext Preprocessor".
Lerdorf 于 1993 年开始使用 C 编写几个通用网关接口 (CGI) 程序,他用这些程序来维护他的个人主页,由此开始了 PHP 的开发。后来,他将它们扩展到与 Web 表单配合使用并与数据库进行通信。PHP 的这种实现是“个人主页/表单解释器”或 PHP/FI。
Lerdorf began PHP development in 1993 by writing several Common Gateway Interface (CGI) programs in C, which he used to maintain in his personal homepage. Later on, He extended them to work with web forms and to communicate with databases. This implementation of PHP was "Personal Home Page/Forms Interpreter" or PHP/FI.
当代,PHP 是世界上最流行的服务器端编程语言,用于构建 Web 应用程序。多年来,它经历了多次修订和版本更新。
Today, PHP is the world’s most popular server-side programming language for building web applications. Over the years, it has gone through successive revisions and versions.
PHP Versions
PHP 是由拉斯姆斯·勒多夫于 1994 年开发的,是一套用 C 语言编写的简单的 CGI 二进制文件。他将这套脚本称为“个人主页工具”。它可以看作是 PHP 1.0 版本。
PHP was developed by Rasmus Lerdorf in 1994 as a simple set of CGI binaries written in C. He called this suite of scripts "Personal Home Page Tools". It can be regarded as PHP version 1.0.
-
In April 1996, Rasmus introduced PHP/FI. Included built-in support for DBM, mSQL, and Postgres95 databases, cookies, user-defined function support. PHP/FI was given the version 2.0 status.
-
PHP: Hypertext Preprocessor – PHP 3.0 version came about when Zeev Suraski and Andi Gutmans rewrote the PHP parser and acquired the present-day acronym. It provided a mature interface for multiple databases, protocols and APIs, object-oriented programming support, and consistent language syntax.
-
PHP 4.0 was released in May 2000 powered by Zend Engine. It had support for many web servers, HTTP sessions, output buffering, secure ways of handling user input and several new language constructs.
-
PHP 5.0 was released in July 2004. It is mainly driven by its core, the Zend Engine 2.0 with a new object model and dozens of other new features. PHP’s development team includes dozens of developers and others working on PHP-related and supporting projects such as PEAR, PECL, and documentation.
-
PHP 7.0 was released in Dec 2015. This was originally dubbed PHP next generation (phpng). Developers reworked Zend Engine is called Zend Engine 3. Some of the important features of PHP 7 include its improved performance, reduced memory usage, Return and Scalar Type Declarations and Anonymous Classes.
-
PHP 8.0 was released on 26 November 2020. This is a major version having many significant improvements from its previous versions. One standout feature is Just-in-time compilation (JIT) that can provide substantial performance improvements. The latest version of PHP is 8.2.8, released on July 4th, 2023.
PHP Application Areas
PHP 是网络上使用最为广泛的语言之一。以下是 PHP 的一些应用领域:
PHP is one of the most widely used language over the web. Here are some of the application areas of PHP −
-
PHP is a server-side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e-commerce sites. Although it is especially suited to web development, you can also build desktop standalone applications as PHP also has a command-line interface. You can use PHP-GTK extension to build GUI applications in PHP.
-
PHP is widely used for building web applications, but you are not limited to output only HTML. PHP’s ouput abilities include rich file types, such as images or PDF files, encrypting data, and sending emails. You can also output easily any text, such as JSON or XML.
-
PHP is a cross-platform language, capable of running on all major operating system platforms and with most of the web server programs such as Apache, IIS, lighttpd and nginx. PHP also supports other services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM, etc.
以下是 PHP 的更多一些重要特性:
Here are some more important features of PHP −
-
PHP performs system functions. It can create, open, read, write, and close the files.
-
PHP can handle forms. It can gather data from files, save data to a file, through email you can send data, return data to the user.
-
You add, delete, modify elements within your database through PHP.
-
Access cookies variables and set cookies.
-
Using PHP, you can restrict users to access some pages of your website.
-
It can encrypt data.
PHP 提供大量的可重复使用的类,并且可以在“PEAR”和“Composer”中找到库。“PEAR”(PHP 扩展和应用程序存储库) 是可重复使用的 PHP 库或类的仓库。“Composer”是 PHP 中的依赖管理工具。
PHP provides a large number of reusable classes and libraries are available on "PEAR" and "Composer". PEAR (PHP Extension and Application Repository) is a distribution system for reusable PHP libraries or classes. "Composer" is a dependency management tool in PHP.