Introduction to PHP
With the rapid development of network technology, the scripting language of creating dynamic Web sites based on server is endless. PHP, with its simplicity, ease of use, portability and so on, in many dynamic Web site language technology unique. So exactly what is PHP, how to use PHP? This chapter will answer these questions in the future. Learning this chapter will give you a general idea of PHP and learn how to add PHP code to your regular Web page.
1.1 about static Web pages and Dynamic Web pages
At present, Web pages have static and dynamic Web pages in two forms. Before talking about both kinds of web pages, take a look at the clients and servers (server) in the composition of the network. A server is a device that has server software installed and can provide services such as Web browsing, database queries, etc. to clients. The client, by contrast, obtains services such as Web browsing and software downloads from the server through client software such as Web browsers. Simply put, the server is the service provider, and the client is the service winner.
1.1.1 Traditional static Web page HTML
Static Web page Implementation mode as shown: Static Web page has the following features: Static Web pages can not be automatically updated. The content of the static Web page does not change with the browsing user, browsing time and other conditions. Once the static Web page is published, whether the viewer browses or not, it is a real existence of a file, all corresponding to a URL. The use of static Web pages to achieve human-computer interaction has considerable limitations.
1.1.2 The difference between dynamic Web pages and traditional Web pages
and static web page implementation of different methods, dynamic Web services are implemented as follows: The client to the server application, the server according to user requests, the dynamic page inside the code first on the server for the corresponding processing, and then send the results of the resulting sent to the client. The pattern is as shown in the figure:
1.1.2 The difference between 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 time, different places to browse the same Dynamic Web page, according to the code processing results different, will return different content.
A Dynamic Web page returns a complete Web page only when it is browsed by a customer and is not a standalone Web page file that exists independently of the server.
Compared with static Web pages, Dynamic Web pages are easier to achieve human-computer interaction.
Web sites built by Dynamic Web pages are easier to maintain than static pages.
1.2 About PHP
The previous section introduces static and dynamic Web pages to readers, and PHP is one of the dynamic Web technologies. So what exactly is PHP, and what is the history of its development? What are some of 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
Earlier, someone interpreted PHP as personal home page, or personal homepage. Some people also call PHP: "Php:hypertext preprocessor". Popularly speaking, PHP is a server-side, Cross-platform, can embed HTML scripting language. The characteristics of server-side execution indicate that it is a dynamic Web page. Cross-platform, it means that PHP can run not only on Linux but also on UNIX or Windows systems. In addition, it can be easily embedded in the ordinary HTML page, the user will do is only in the ordinary HTML page to add PHP code.
Development History of 1.2.2 PHP
PHP was first developed by Rasmus Lerdorf in 1994. In the middle of 1995 again released the 2nd version of PHP, named Php/fi (Form interpreter).
A third version of the development Plan was launched in 1997, and the development team joined Zeev Suraski and Andi Gutmans, and the third edition was named PHP 3.0.
May 2000, PHP 4.0 officially released. It uses the Zend (Zeev+andi) engine to provide higher performance.
July 2004, PHP 5 was published. The Birth of PHP 5, so that PHP programming into a new era. The adoption of Zend II engine, complete object model, improved syntax design. Eventually makes PHP a fully designed, truly object-oriented scripting language.
1.2.3 PHP compared to other CGI programs
Also as a service-side programming language, PHP and other CGI programs such as ASP.net, JSP and other features of its own, 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!
Add PHP code to the 1.3.1 page
PHP is a language that can be embedded. That is, it can easily be added to a common HTML page. When a user requests a PHP file, the relevant 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.
Add a comment to the 1.3.2 PHP page
PHP has three kinds of annotations:
Single-line Comment: #,//
Multiline Comment:/*some code*/
Above introduced the PHP Foundation, the PHP Basic course, understands above content is the study PHP Foundation, hoped that has the help to everybody.