Home > Article > Backend Development > How to generate static web pages with PHP
1. PHP scripts and dynamic pages.
PHP script is a server-side script program that can be mixed with HTML files through methods such as embedding, or it can process user requests in the form of templates in the form of classes, function encapsulation, etc. One way or another, the basics of it are this. The client makes a request for a certain page -----> The WEB server introduces the specified corresponding script for processing -----> The script is loaded into the server -----> PHP parsing specified by the server The script is parsed by the browser to form an HTML language form----> The parsed HTML statement is sent back to the browser in the form of a package. It is not difficult to see from this that after the page is sent to the browser, PHP no longer exists and has been converted and parsed into HTML statements. The client request is a dynamic file. In fact, there is no real file there. PHP parses it into the corresponding page and then sends it back to the browser. This way of handling pages is called "dynamic pages".
Second, static page.
Static pages refer to pages that actually exist on the server side and only contain HTML and JS, CSS and other client-side scripts. The way it's handled is. The client makes a request for a certain page----> The WEB server confirms and loads a certain page----> The WEB server passes the page back to the browser in the form of a package. From this process, we can compare the dynamic pages and we can see. Dynamic pages need to be parsed by the PHP parser of the WEB server, and usually need to connect to the database and perform database access operations before they can form an HTML language information package; while static pages do not need to be parsed or connected to the database, and can be sent directly, which can greatly Reduce server pressure, improve server load capacity, and greatly improve page opening speed and overall website opening speed. But its disadvantage is that the request cannot be processed dynamically, and the file must actually exist on the server.
Three, templates and template analysis.
The template means that the content html file has not yet been filled in. For example:
temp.html