search

1.WebHow the program works

(1) The meaning of the word Web

Network:【Computer】Computer network, network

Web: [Computer] World Wide Web (World Wide Web), Internet (Internet)

Webprogram, as the name suggests, is a program that works on Web.

(2) Working principle of stand-alone program

A stand-alone computer, that is, a computer that is not connected to other computers and is not in a network. For example: two single machines A, B, only the program X is installed on A, if you want to get the running results of X on B , you must install X on B and then run it. If there are many B computers, you need to install and run them one by one. They cannot communicate and collaborate directly with each other. As shown in Figure 1.

(3) Client/Working principle of server program

Connect single machines into a network, such as connecting A and B into a network, then they can provide services between them, such as A providing services to B. Common services are file sharing, FTPfile downloading, etc. We call the computer that provides (responds to) services a server (Server), and the computer that accepts (requests) services is called a client (Client), also called a workstation (Workstations). The working principle of the client /server program is shown in Figure 2.

The roles of server and client can be switched. A computer can provide services to itself. At this time, it is both a server and a client. For example, if the computer A shares its own folder a, and then finds A on the Internet, you can download a, means that you have provided services to yourself, requested and Service responded.

This method of inter-computer collaboration between

client/server is called C/Smethod, or C/Sarchitecture.

C/SThe program is divided into two parts: server side and client side, which are called server-side program (or service program) and client program (or client program) respectively. For client programs, each client must be installed separately. This is the same as the distribution of stand-alone programs, and it is also very troublesome. However, after the client program is installed, you can interact with the server through the communication line, or communicate with other clients through the server. A typical example is the commonly used chat program QQ, as shown in Figure 3.

(4) Browser/How the server program works

If you send a request to the server through the browser (Browser) in the client and receive the result of its response, then, at this time, we call this collaboration method B/S method, or B/S architecture, its working principle is shown in Figure 4:

At this time, the client program is the browser, and the installation of the browser is completed with the installation of the operating system, and does not require additional installation by the user. For them, when using B/S programs (such as reading news online, sending and receiving emails), they do not need to install special client programs and can operate directly in the browser. This makes the maintenance of the B/S program very convenient, because you don’t have to worry about the client program, you only need to maintain the server program.

(5)C/S, B/SComposition of server

A server is a machine responsible for service tasks. These service tasks are generally completed by specialized software. Generally speaking, server software with certain service functions and the machine on which it is located are collectively referred to as XXservers (XX represents a specific service). These software can be concentrated in one machine (as shown in the figure 5), such a machine can be called a centralized server; or they can exist alone in a certain machine (as shown in the figure 6), like this A machine can be called a stand-alone server, and multiple stand-alone servers can form a server farm or matrix.

According to service tasks, several common server software are shown in Table 1.

Server-side script: A program written in a server-side programming language.

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

(6)B/SThe specific process of program work (picture 7)

(7)PHP The specific process of program work

The specific process is a collaboration process between Apache, PHP, and browsers:

The user requests the PHP file from the server through the browser (such as entering in the address bar: http://localhost/index.php), Apache looks for the file requested by the browser in the user document release directory on the server PHP file, if it is not found, an error message will be returned to the browser, otherwise, it will be submitted to the PHP interpreter for interpretation and execution, and the PHPinterpreter will respond to PHP The file is grammatically analyzed. If a grammatical error is found, the error message (represented by a code that the browser can recognize) is returned to the browser via Apache, otherwise the PHP program (which may include database The operation of MySQL), will return the PHP program execution result (represented by a code that the browser can recognize) to the browser via Apache, and the browser will interpret and execute the returned result. , the execution results are displayed in the browser window.

If the file requested by the browser is not a PHP file, but a HTML file or a JavaScript file. The process will be simplified: Apache looks for the HTML file or JavaScript file requested by the browser in the user document release directory on the server. If it is not found, an error message is returned to the browser. Otherwise, it is returned to the browser, the browser interprets and executes the returned results, and the execution results are displayed in the browser window.

2. Browser working process

(1)WebClient workProcess

Any application system must have an interface that provides user operations, that is, the user interface. The work of the browser, from the perspective of the entire B/S program, is an interface (interface) for users to interact with the B/S program. Its mission is:

A. Collect user-entered data

B. Send user data to server

C. Receive the response returned by the server

D. Interpret and execute these codes

It can be seen that the browser plays the role of an agent (Agent) of the server to the user. This agent has the role of collecting messages, requesting responses, and interpreting instructions sent back by the server.

(2)WebClient Code

Whether it is organizing the interface used to collect user data, or interpreting instructions from the server to form the resulting interface, it is all implemented using Web client code. Commonly used Web client codes include HTML language, JavaScript language, CSS, XML and other languages.

3.HTMLHow it works

(1)HTMLIntroduction

HTML: Hyper Text Markup Language , hypertext markup language.

At the end of the

20century80, Tim Berners-Lee worked at the European Particle Physics Laboratory (CERN: the European Laboratory for Particle Physics) WWW The father of ) discovered through research that people’s visual processing is based on pages. So he came to a conclusion: electronic data should be presented in pages. With this as a starting point, he used hypertext-centric management methods to organize information on the Internet, and proposed methods for accessing and browsing web pages: established a hypertext markup language; designed the Hypertext Transfer Protocol (HTTP : Hypertext Transport Protocol), used to obtain hyperlinked files; use Uniform Resource Locator (URL: Uniform Resource Locator) to locate network files, sites or servers.

(2)HTMLHow it works

HTML is not essentially a programming language, but a markup language. The so-called mark is also called a label in some books. From an object-oriented perspective, it means the identification of browser objects. It is used to control the performance of browser sub-objects such as text and images in the browser, as well as how to establish tags for links between files. These tags are placed in text format files. The biggest difference between programs is that they can be used to control the operating system or application program to execute and complete a certain job. Hypertext Markup Language documents should be as formal as possible to have the same effect regardless of whether they are opened in any browser on any operating system.

(3)Basic structure of HTML

A. Version statement, that is, prologue (Prologue)

B.Head(Head

C.Body (Body)

The above introduces the working principle of Web programs, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement
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
PHP's Purpose: Building Dynamic WebsitesPHP's Purpose: Building Dynamic WebsitesApr 15, 2025 am 12:18 AM

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP: Handling Databases and Server-Side LogicPHP: Handling Databases and Server-Side LogicApr 15, 2025 am 12:15 AM

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

How do you prevent SQL Injection in PHP? (Prepared statements, PDO)How do you prevent SQL Injection in PHP? (Prepared statements, PDO)Apr 15, 2025 am 12:15 AM

Using preprocessing statements and PDO in PHP can effectively prevent SQL injection attacks. 1) Use PDO to connect to the database and set the error mode. 2) Create preprocessing statements through the prepare method and pass data using placeholders and execute methods. 3) Process query results and ensure the security and performance of the code.

PHP and Python: Code Examples and ComparisonPHP and Python: Code Examples and ComparisonApr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP in Action: Real-World Examples and ApplicationsPHP in Action: Real-World Examples and ApplicationsApr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP: Creating Interactive Web Content with EasePHP: Creating Interactive Web Content with EaseApr 14, 2025 am 12:15 AM

PHP makes it easy to create interactive web content. 1) Dynamically generate content by embedding HTML and display it in real time based on user input or database data. 2) Process form submission and generate dynamic output to ensure that htmlspecialchars is used to prevent XSS. 3) Use MySQL to create a user registration system, and use password_hash and preprocessing statements to enhance security. Mastering these techniques will improve the efficiency of web development.

PHP and Python: Comparing Two Popular Programming LanguagesPHP and Python: Comparing Two Popular Programming LanguagesApr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

The Enduring Relevance of PHP: Is It Still Alive?The Enduring Relevance of PHP: Is It Still Alive?Apr 14, 2025 am 12:12 AM

PHP is still dynamic and still occupies an important position in the field of modern programming. 1) PHP's simplicity and powerful community support make it widely used in web development; 2) Its flexibility and stability make it outstanding in handling web forms, database operations and file processing; 3) PHP is constantly evolving and optimizing, suitable for beginners and experienced developers.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.