The 1th chapter of the first knowledge of PHP
With the rapid development of network technology, a variety of scripting languages based on the service side to create dynamic websites are emerging. PHP, with its simplicity, ease of use, portability and so on, in a number of dynamic website language technology unique. So what exactly is PHP, and how do I use PHP? This chapter will answer these questions in the future. The study in this chapter will give the reader a general understanding of PHP and will learn how to add PHP code to a normal Web page.
1.1 about static Web pages and Dynamic Web pages
At present, the Web pages have static pages and Dynamic Web page two forms. Before you talk about these two kinds of web pages, let's look at the client and server in the network composition (server). A server is a device that has server software installed and can provide clients with services such as Web browsing, database queries, and so on. The client, by contrast, obtains services such as Web browsing and software downloads from the server via the client software such as a Web browser. Simply put, the server is the service provider, and the client is the service recipient.
1.1.1 Traditional static Web page HTML
Static Web page Implementation mode: Static Web pages have the following features: Static Web pages can not be updated automatically. The content of the static Web page does not change with the browsing user, browsing time and other conditions. When a static Web page is published, it is a real file and corresponds to a URL, regardless of whether the browser is browsing or not. The use of static Web pages to achieve human-computer interaction has considerable limitations.
The difference between 1.1.2 Dynamic Web pages and traditional Web pages
and static Web page implementation method is different, the Dynamic Web service implementation process is as follows: The client to the server request, the server according to the user request, the Dynamic Web page internal code on the server to do the corresponding processing, and then send the resulting results to the client. Its mode:
The difference between 1.1.2 Dynamic Web pages and traditional Web pages
Dynamic Web pages have the following features:
Dynamic Web pages run on the server side.
Different people, different times, different places to browse the same Dynamic Web page, according to the code processing results, different content will be returned.
A Dynamic Web page returns a full page only when viewed by a customer, and is not itself a Web page file that exists independently of the server.
Dynamic Web pages make it easier to achieve human-computer interaction than static Web pages.
Dynamic Web sites are built to be easier to maintain than static Web pages.
1.2 About PHP
The previous section introduced static and dynamic Web pages to readers, while PHP was one of the dynamic Web technologies. So what is PHP, and what is the history of it? What are the features of PHP compared to other dynamic Web technologies? This section will answer these questions for the reader.
1.2.1 What is PHP
In the early days, PHP was interpreted as a personal home page, or a personal home page. Someone also called PHP: "Php:hypertext preprocessor". In layman's words, PHP is a server-side, cross-platform, HTML-capable scripting language. The server-side execution features indicate that it is a dynamic Web page. Cross-platform, that is, PHP can not only run under the Linux system can also run under the UNIX or Windows system. In addition, it can be easily embedded in the normal HTML page, the user is only to do in the ordinary HTML page to add PHP code.
1.2.2 Development History of PHP
PHP was originally developed by Rasmus Lerdorf in 1994. The 2nd version of PHP, named Php/fi (Form interpreter), was released in the middle of 1995.
The third edition of the development Plan began in 1997, and the development team joined Zeev Suraski and Andi Gutmans, while the third edition was named PHP 3.0.
In May 2000, PHP 4.0 was officially released. It uses the Zend (Zeev+andi) engine to provide higher performance.
PHP 5 was introduced in July 2004. The advent of PHP 5 has allowed PHP programming to enter a new era. Zend II engine Adoption, complete object model, improved grammar design. Eventually makes PHP a well-designed scripting language with real object-oriented capabilities.
1.2.3 PHP compared to other CGI programs
Similarly, as a service-side programming language, PHP and other CGI programs, such as ASP. NET, JSP and so on compared with its own characteristics, mainly in the following aspects: Web server support. Support for running the platform. Scripting languages are different. Database support is different. Object-oriented support is different.
1.3 First Program--hello world!
HELLO world!
PHP echo "HELLO world!"; // print a string with echo ?>
Add PHP code to the 1.3.1 page
PHP is a language that can be embedded. In other words, it can easily be added to common HTML pages. When a user requests a PHP file, the associated PHP code interprets the execution on the server side, generates new HTML information, and sends it to the user along with the original HTML code.
1.3.2 Add comments to the PHP page
PHP has three types of annotations:
Single-line Comment: #,//
Multiline Comment:/*some code*/
The above describes 11 about static Web pages and dynamic Web pages, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.