PHP static pages

Source: Internet
Author: User
I. INTRODUCTION in terms of speed, static pages are much faster than dynamic pages in php. this is without a doubt, but due to the poor mobility of static pages, if the related information is not retained by the database or other devices, the overall management is more complicated.

1. Introduction

In terms of speed, static pages are much faster than dynamic pages in php. this is without a doubt, but due to the poor mobility of static pages, if the related information is retained without the help of databases or other devices, the overall management is relatively cumbersome. it is similar to browsing permission restrictions. However, it corresponds to some files that are frequently used. it is similar to the developed message announcing system. we don't expect many users to read the database to see the results, on the one hand, it consumes server resources, and on the other hand, it takes a lot of valuable response time for viewers. all websites use this technique with 'static page, these skills are generally controlled by the governance background, or are directly displayed by natural html, or display by css in xhtml, or display by natural xml in xslt, here I will talk about the natural html method in a simple way.

2. preparation knowledge 

Template tips:

[PHP]Template engine Smarty-- 2005-12-31
[PHP]Tips on configuration and application of Smarty-- 2006-01-04

Cache tips:

Some information is often the same, but it can still be changed in the cache to speed up the display, this is very valuable, the so-called cache, the general understanding is that some of the information is reserved on the server really shared. it is because the server is born with the same death. when we keep the cache, we can specify the determination of the next update time. it is equivalent to updating once every 5 minutes, and we can record the last update time, compared with the current time, if it is more than 5 minutes, read the database, replace the update with, otherwise directly read the cache data, of course, the cache needs to be activated by the client user, only once.

Ob_start () function: Open the output buffer.
Function pattern void ob_start (void)
Note: When the buffer zone is activated, all non-file header information from the PHP program is not sent, but is kept in the internal buffer zone. To output the buffer content, you can apply ob_end_flush () or flush () to output the buffer content.

Flush: refresh the buffer content and output it.
Function pattern: flush ()
Clarification: This function is often used and highly efficient.

Ob_get_contents: returns the content of the internal buffer.
Function pattern: string ob_get_contents (void)
Clarification: This function will return the content in the current buffer. if the output buffer is not activated, FALSE is returned.

Ob_get_length: returns the length of the internal buffer.
Function pattern: int ob_get_length (void)
Clarification: This function returns the length of the current buffer. it is the same as ob_get_contents. if the output buffer is not activated, FALSE is returned.

Ob_end_clean: deletes the content of the internal buffer and closes the internal buffer.
Function pattern: void ob_end_clean (void)
Clarify: This function will not output the content of the internal buffer but delete it.

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.