How the Web Works

Source: Internet
Author: User
Tags ftp file php language

How 1.WEB programs work

(1) Meaning of the word Web

Network: "Computer" computer networks, net

Web: "Computer" www (World Wide Web), Internet (Internet)

Web programs, as the name implies, are programs that work on the web.

(2) Operating principle of stand-alone program

A single machine, a computer that is not connected to another computer, is not in the network. For example: Two stand A, B, only a program x is installed on a, to get x running results on B, you must install the X on the B, and then run. If you have more computers in class B, you will need to install them individually. There is no direct communication and collaboration between them. As shown in 1.

(3) How the client/server program works

Connecting a single machine to a network, such as connecting A to B, allows services to be provided between them, such as a to B service. Common services are file sharing, ftp file download, and so on. We refer to the computer that provides the service (the response) as the server (server), and the computer that accepts the service (request) is called the Client (client), also called the workstation (workstations). The client/server program works as shown in 2.

The roles of the server and the client can be converted. A computer that can provide services to itself, when it is both a server and a client. For example, if computer A shares its own folder A and then finds a on the network, you can download a, which means that you have provided the service to yourself and you have requested and responded to the service.

Client/server collaboration between computers, called C/s mode, or C/s architecture.

The C/S program is divided into two parts: server-side and client-side, which are called server-side programs (or service programs) and client programs (or client programs). For the client program, for each client, also have to install separately, this is the same as the distribution of the single-machine program, is also very troublesome. However, after the client program is installed, it is possible to interact with the server through the communication line, or through the server, to communicate with other clients. A typical example is the usual chat program qq,3 shown.

(4) How the browser/server program works

If a request is made to the server via a browser (Browser) in the client, and the result of its response is received, then we call this collaborative method as B/s or b/s architecture, which works as follows: 4

At this point, the client program is the browser, and the installation of the browser with the operating system is completed, do not require additional user installation. For them, the use of B/s program (such as the internet to watch news, send and receive e-mail), you do not need to install a dedicated client program, directly in the browser to operate. This makes the B/S program maintenance is very convenient, because no tube client program, as long as the maintenance of the server-side program can be.

(5) Composition of c/S, b/s server

Server is the machine that is responsible for the service task. These service tasks are done by the general specialized software. Generally, the server software with a certain service function and the machine on which it resides are collectively referred to as XX servers (xx denotes a specific service). These software can be centralized in a single machine (5), such a machine can be called a centralized server, or can exist in a single machine (6), such a machine can be called a standalone server, multiple standalone servers can form a server farm or matrix.

Following the service tasks, several common server software are shown in table 1.

Server-side scripting: programs written in the server-side programming language.

Server-side programming language: A programming language, such as the PHP language, that runs only on the server side and is interpreted and executed by the server.

(6) b/S procedure work of the specific process (7)

(7) The specific process of PHP program work

The process is a collaborative process between Apache, PHP, and the browser:

The user requests the PHP file through the browser to the server (for example, in the Address bar input: http://localhost/index.php), Apache on the server in the user document publishing directory to find the PHP file requested by the browser, if not found, then return the error message to the browser, otherwise, Submit it to the PHP interpreter to interpret the execution, the PHP interpreter to parse the PHP file, if you find a syntax error, the Apache return error message (in the browser can be recognized code) to the browser, or execute the PHP program (may contain the operation of the database MySQL), The results of the execution of the PHP program (denoted by the browser-recognized code) are returned to the browser via Apache, and the browser interprets, executes, and executes the results displayed in the browser window.

If the browser is requesting a file that is not a PHP file, it is an HTML file or a JavaScript file. The process will be simplified: Apache finds the HTML file or JavaScript file requested by the browser under the user's document publishing directory on the server, returns an error message to the browser if it is not found, otherwise returns it to the browser and the browser interprets and executes the returned results. The results of the execution are displayed in the browser window.

2. Browser work process

(1) Web Client working process

Any application system must have an interface that provides user action, that is, the user interface. The work of the browser, from the whole B/S program, is the user and B/s program dealing with an interface (interface). Its mission is to:

A. Collecting data entered by the user

B. Sending user data to the server

C. Response returned by the receiving server

D. Explain, execute the code

As you can see, the browser plays the role of a proxy (agent) for the server in the user. This agent has the function of collecting messages, requesting responses, and explaining the instructions that the server sends back.

(2) Web client code

Whether the interface that the organization uses to collect user data, or the instructions from the server to form the resulting interface, are implemented with Web client code. Common Web client code is HTML language, JavaScript language, CSS, XML and other languages.

3.HTML Working principle

(1) Introduction to HTML

Html:hyper text Markup Language, Hypertext Markup Language.

Tim, the late 1980s, working at the European Particle Physics Laboratory (cern:the European labloratory for particle Physics) Berners-lee (the father of www) found that people's visual processing is based on pages. So he came to the conclusion that electronic data should be presented in the form of pages. Taking this as the starting point, he used hypertext-centric management to organize the information on the network, and proposed the method of establishing the access and browsing Web pages: The Hypertext Markup Language was established, and the Hypertext Transfer Protocol (Http:hypertext Transport Protocol) was designed. Used to get a hyperlink file, use the Uniform Resource Locator (Url:uniform Resource Locator) to locate a network file, site, or server.

(2) How HTML works

HTML is not a programming language in nature, but a markup language. The so-called Mark, in some books also called tags, from an object-oriented point of view, is the meaning of the browser object identification. It is used to control the performance of text, images, and other browser sub-objects in the browser, as well as how to establish a link between files tags. These tags are placed in a text-formatted file. The biggest difference between programs is that they can be used to control the operating system or application to execute and complete a job. Hypertext Markup Language documents should be done as much as possible, formally, regardless of any operating system on any browser open has the same effect.

(3) Basic structure of HTML

A. Version declaration, order (prologue)

B. Header (head)

C. Body (body)

Reprint: Nickname: ProCD's Garden

How the Web Works

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.