Home >Common Problem >How does a web page work?
How does the web page work? The following article will introduce to you how the web page works. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Web pages are divided into static web pages and dynamic web pages. Their working principles are as follows:
1. The working principles of static web pages are as follows:
Request-download and parse at the same time, load the style first to display the web page structure, and the JS function needs to be driven and executed by itself. (Some JS functions need to be run when the page is loaded, such as the data initially displayed on the chart. There are two methods:
1. Use automatic execution functions in the chart source code: $(function(){go_( );}));
2. Use the body tag in the chart source code: < body onLoad="go_();" >
Specific steps:
A. The user enters the address to be accessed in the address bar of the browser and presses Enter to trigger this browsing request.
B. The browser sends the request to the Web server.
C. The Web server accepts this request and determines whether it is an HTML file based on the suffix name of the requested file.
D. The Web server reads the correct HTML file from the specified location on the server's hard disk or memory and then sends it to the requesting browser.
E. The user's browser parses these HTML codes and displays it.
2. The working principle of dynamic web pages is as follows:
When the user requests a dynamic web page, the server has to do more work to process the information requested by the user. Send it back, and the server generally works according to the following steps:
A. The server accepts the request.
B. The web server reads dynamic web page files from the location specified on the server hard disk or memory.
C. Execute the program code of the web page file and convert the dynamic web page containing the program code into a standard static page (HTML).
D. The web server sends the generated static page code to the requesting browser.
Recommended learning: PHP video tutorial
The above is the detailed content of How does a web page work?. For more information, please follow other related articles on the PHP Chinese website!