Talk about some experiences in generating static pages

Source: Internet
Author: User
Tags html page php file string
static | page
Author: q3boy
Static page generation generally have such a few ideas.
1. In the process of program writing. Statements that do not use direct output. When all the output is connected to the output string, the output is completed. Write output string contents directly to File
2. Written in the normal way. Captures the output through the OB function group. The output is then written to the file
3. When using a template class, the output is obtained using a Get/fetch method. and write to the file.

And there are two ways to implement it.
1. When you manage to add records in the background, the target HTML page is generated directly, and the foreground call connection directly points to the generated HTML page. The advantage of this approach is that the program is most efficient. Server load is light, but because the generated is a pure static page, once the page style changes, you must regenerate all the content pages. So the actual use of the application is generally not too much. More is the use of js,ssi,xml/xsl, such as client tools, the generated static file to save only data, does not involve style, so as to achieve speed and maintenance of the balance, but relative to the front and back of the program to be more complex (when applied this method, because the content is pure static, Can be paired with a standalone, purely static Apache. Better efficiency and resource consumption than includes dynamic content support

2. The front access link to the PHP program, the PHP program first check whether there is a corresponding static file. If the static file does not exist. is generated and redirected to this file, otherwise direct redirection. This method is actually used in conjunction with the Url_rewrite function of Apache. The PHP file address to the form of HTML, in favor of search engine retrieval. This method has a slight loss in efficiency, but the program structure is simple and easy to adjust, it is appropriate to use when the traffic is not very large.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.