Talk about some experiences that generate static pages

xiaoxiao2021-03-06  42

I saw a post in the downstairs discussing the generation of static pages. Here is some of my personal experience, interested, welcome to discuss it. The generation of static pages generally has such a few ideas. . 1. The program is written during the program. Do not use the direct output statement. When all outputs are connected to the output string, after the output is complete. Then write the output string content directly to the file 2. Written in normal ways. Capture the output by the OB function group. Then write the output to file 3. When using a template class, the output is obtained with the method of GET / FETCH. And write to the file. There are two methods in the specific implementation. When you add a record, you can generate the target HTML page directly, and the front call connection directly points to the generated HTML page. This method is the highest in program efficiency. The server load is light, but since the generated pure static page, once the page style has changed, all content pages must be regenerated. So the application in actual use is generally not too much. More is the use of clients such as JS, SSI, XML / XSL, and only save data in the generated static file, does not involve styles, so that speed and maintenance balance can be achieved, but it is complex relative to the front and backbound procedures (application) When this method, since the content is pure static, it can be used with pure static Apache, which is compiled. The front access link points to the PHP program, and the PHP program first checks if there is a corresponding static file. If the static file does not exist. Then generate and redirect to this file, otherwise redirect directly. This method is actually used in conjunction with the URL_rewrite functionality in Apache. Will be in the form of HTML of the PHP file address, which is conducive to the search engine search. This method is slightly losses in efficiency, but the program structure is simple, easy to adjust, and use is suitable when the amount of access is not very large. .

转载请注明原文地址:https://www.9cbs.com/read-52957.html

New Post(0)