Home > Backend Development > PHP Tutorial > Talk about some experience in generating static pages_PHP tutorial

Talk about some experience in generating static pages_PHP tutorial

WBOY
Release: 2016-07-13 17:26:10
Original
765 people have browsed it


Author: q3boy
There are generally several ideas for generating static pages. .
1. In the process of programming. Do not use direct output statements. And when all output is connected to the output string, after the output is completed. Then directly write the output string content to file
2. Write in the normal way. Capture output through the ob function group. The output is then written to file
3. When using template classes, use methods such as get/fetch to obtain output. and write to file.
There are two methods for specific implementation
1. When adding records in the management background, the target html page is directly generated, and the front-end call connection directly points to the generated html page. The advantage of this method is that the program is most efficient. The server load is light, but because it generates purely static pages, all content pages must be regenerated once the page style is changed. Therefore, there are generally not too many applications in actual use. More often, client-side methods such as js, ssi, xml/xsl, etc. are used. The generated static files only save data and do not involve styles. This can achieve a balance between speed and maintainability, but it is more complicated than the front-end and back-end programs (application In this method, since the content is purely static, it can be used with a separately compiled purely static apache. The efficiency and resource usage are better than those containing dynamic content)
2. The front-end access link points to the php program, and the php program first checks whether the corresponding static file exists. If the static file does not exist. Then it is generated and redirected to this file, otherwise it is redirected directly. In actual use, this method is generally used together with the url_rewrite function of apache. Reset the php file address to html format to facilitate search engine retrieval. This method has a slight loss in efficiency, but the program structure is simple and easy to adjust, so it is suitable when the number of visits is not very large. .

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/532002.htmlTechArticleAuthor: q3boy There are generally several ideas for generating static pages. . 1. In the process of programming. Do not use direct output statements. And when concatenating all outputs to the output string,...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template