PHP page staticization—the principle of realizing pure static page

WBOY
Release: 2016-08-08 09:21:55
Original
1311 people have browsed it

The ultimate goal of php to achieve pure static page is to generate pure html file, and this pure html file is stored in the server's disk;

What php needs to achieve pure static page:

1. File writing function

file_put_contents(), or functions such as fopen(), fwrite(), fclose();

2, buffer (cache) operation function

ob function (ob_start() , ob_get_contents(), ob_clear(), ob_get_clearn(), etc.);

ob_start() — open the "output control buffer";

ob_get_contents() — return the "contents of the output buffer";

ob_clearn() — clear (erase) the "output buffer";

ob_get_clearn() — get the contents of the current buffer and delete the current "output buffer";

said in a previous article However, when we are executing a php program, if the php program has data output, then the data will first be output to the php buffer, and then the buffer will transmit the data to the client through tcp and display it;

So with the above ob function (output control buffer function), we can achieve our goal by controlling the output of the buffer, which is to achieve the staticization of the

page;

The above introduces the staticization of PHP pages - the principle of realizing pure staticization of pages, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!