How Web programs work, how Web works _php tutorials

Source: Internet
Author: User

How Web programs work and how the Web works


How 1.WEB programs work

(1) meaning of the word Web

Network: "Computer" computer networks, net

Web: "Computer" www (WorldWide 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 on a is installed program X, in order to B to get The result of x running, you must install it on b again x , 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 a server (server), and the computer that accepts the service is called a client (client), also called a 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 aon the network, youcan download A, you provide services to yourself, you request and respond 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. The typical example is the chat program QQ, which is commonly used by everyone ,3 shows.

(4) How the browser / Server program works

If a request is made to the server through a browser (Browser)in the client,receiving the result of its response, then we call this collaboration a b/S method, or b/S architecture, how it works 4 as shown:

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). The software can be centralized in a single machine (5), which can be called a centralized server, or it can exist in a single machine (6), such a machine can be called a standalone server , multiple stand-alone 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 a PHP file from the browser to the server (for example, in the Address field:http://localhost/index.php), Apache In the server on the user document publishing directory to find the browser requested PHP file, if not found, then return the error message to the browser, otherwise, submit it to the PHP interpreter to interpret the execution, the PHP parser parses the php file, and if a syntax error is found, the Apache Returns an error message (represented by a code that the browser can recognize) to the browser, otherwise executes the PHP Program (which may contain operations on the database MySQL ), the PHP Program execution results (in the browser can be recognized code) returned to the browser by Apache , the browser to the return of the results of interpretation, execution, The results of the execution are 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 requested by the browser under the User document publishing directory on the server file, if it is not found, return the error message to the browser, otherwise, return it to the browser, the browser to interpret the returned results, execution, the results of the execution is 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.

at the end of the century, at the European Particle Physics Laboratory (CERN:the European labloratory For particle Physics) working Tim Berners-lee(WWW The father of the study found that people's visual processing is based on the page. 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), used to get the hyperlink file; Use the Uniform Resource Locator (URL:Uniform Resource Locator) to locate network files, sites, or servers.

(2)howHTML 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)

http://www.bkjia.com/PHPjc/931894.html www.bkjia.com true http://www.bkjia.com/PHPjc/931894.html techarticle How Web programs work, how the Web Works 1.WEB programs Works (1) The meaning of the word Web: "Computer" computer network, Web: "Computer" World Wide Web (worldwid ...

  • 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.