11 About static web pages and dynamic web pages

WBOY
Release: 2016-07-30 13:30:35
Original
1632 people have browsed it

Chapter 1 First introduction to PHP

The current network technology is developing rapidly, and various scripting languages ​​​​based on creating dynamic websites on the server are emerging in endlessly. Among them, PHP is unique among many dynamic website language technologies due to its simplicity, ease of use, and strong portability. So what exactly is PHP and how to use PHP? This chapter will answer these questions. Through studying this chapter, readers will have a general understanding of PHP and learn how to add PHP code to ordinary Web pages.

1.1 About static web pages and dynamic web pages

Currently, there are two types of web pages on the Internet: static web pages and dynamic web pages. Before talking about these two web pages, let's first understand the client (Client) and server (Server) in the network structure. A server is a device that has server software installed and can provide services such as web browsing, database query, etc. to clients. The client, on the other hand, obtains services such as web browsing and software downloading from the server through 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

The implementation model of static web pages is as shown in the figure: Static web pages have the following characteristics: Static web pages cannot be automatically updated. The content of static web pages does not change with changes in conditions such as browsing users and browsing time. Once a static web page is published, no matter whether the viewer browses it or not, it is a real file and corresponds to a URL. There are considerable limitations in using static web pages to achieve human-computer interaction.

1.1.2 The difference between dynamic webpages and traditional webpages

Different from the implementation method of static webpages, the implementation process of dynamic webpage services is as follows: the client applies to the server, and the server puts the code inside the dynamic webpage first according to the user's request. Corresponding processing is performed on the server, and the generated results are sent to the client. The model is shown in the figure:

1.1.2 The difference between dynamic web pages and traditional web pages

Dynamic web pages have the following characteristics:

Dynamic web pages run on the server side.

Different people, at different times and in different places, browse the same dynamic web page, and different content will be returned based on the code processing results.

A dynamic web page will only return a complete web page when it is browsed by the customer, and it is not a web page file that exists independently on the server.

Compared with static web pages, dynamic web pages are easier to achieve human-computer interaction.

Websites built with dynamic web pages are easier to maintain than static web pages.

1.2 About PHP

The previous section introduced static web pages and dynamic web pages to readers, and PHP is one of the dynamic web page technologies. So what is PHP and what is its development history? Compared with other dynamic web technologies, what are the characteristics of PHP? This section will answer these questions for readers.

1.2.1 What is PHP

In the early days, some people interpreted PHP as Personal Home Page, that is, personal home page. Some people also call PHP: "PHP: Hypertext Preprocessor". In layman's terms, PHP is a server-side, cross-platform scripting language that can be embedded in HTML. The characteristics of server-side execution indicate that it is a type of dynamic web page. Cross-platform means that PHP can run not only on Linux systems but also on UNIX or Windows systems. In addition, it can be easily embedded into ordinary HTML pages. All the user has to do is to add PHP code to ordinary HTML pages.

1.2.2 Development History of PHP

PHP was originally developed in 1994 by Rasmus Lerdorf. In mid-1995, the second version of PHP was released, named PHP/FI (Form Interpreter).

The development plan for the third version started in mid-1997. The development team joined Zeev Suraski and Andi Gutmans, and the third version 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.

In July 2004, PHP 5 came out. The birth of PHP 5 has brought PHP programming into a new era. The adoption of Zend II engine, complete object model and improved syntax design. Finally, PHP becomes a fully designed scripting language with true object-oriented capabilities.

1.2.3 Comparing PHP with other CGI programs

As a server-side programming language, PHP has its own characteristics compared with other CGI programs such as ASP.NET, JSP, etc., which are mainly reflected in the following aspects: Web Server support. Running platform support. Scripting languages ​​are different. Database support varies. Object-oriented support is different.

1.3 The first program-HELLO WORLD!

<html>
<head>
<title>HELLO WORLD!</title>
</head>
<body>
<!--以上为普通HTML代码,以下为PHP代码-->
<?<span>php
    </span><span>echo</span> "HELLO WORLD!";                                    <span>//</span><span>用echo打印字符串</span>?>
<!--以上为PHP代码-->
</body>
</html>
Copy after login

1.3.1 Add PHP code to the page

PHP is an embeddable language. In other words, it can be easily added to common HTML pages. When a user requests a PHP file, the relevant PHP code is first interpreted and executed on the server side to generate new HTML information, which is then sent to the user together with the original HTML code.

1.3.2 Add comments to PHP pages

PHP has three kinds of comments:

Single-line comments: #,//
Multi-line comments: /*some code*/

The above has introduced 11 aspects about static web pages and dynamic web pages, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!