Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
Web| News | static | Web page In recent years, the World Wide Web (also known as Global Information Network, WWW) has been changing the face of information technology. The web has quickly become an effective medium for people and business to communicate and collaborate. Almost all information technology areas are generally influenced by the web. Web Access brings more users and more data, which means more pressure on servers and databases and end users getting slower and faster response times. Web Dynamic page Surface statics should be a more practical and economical option than increasing the CPU, disk drives, and memory to keep up with this growing demand.
The implementation function of the Dynamic Web Web page static with PHP is shown in functions like function gen_static_file ()
This function is the key to the implementation of static, that is, the PHP dynamic page program is not sent to the browser, but entered into a file named $filename (see Figure 2). Two parameters in the $program is a PHP dynamic page program, $filename is the name of the generated static page (can be based on the need to make their own naming rules, this is important, see below),/usr/local/php4/bin/ PHP is the part of PHP that has the function of inputting programs into files, and system is the function of executing external commands in PHP. We can also see that all the PHP programs that generate dynamic pages should be placed in the/php/directory, and all new static pages will appear in the/static_html/directory (these paths can be set according to the specific needs).
Let's take a concrete example and see how the college_static.php static page is generated.
function gen_college_static ()
for ($i = 0; $i 〈= $i ++〉
Putenv ("province_id=". $i); *.php files are used when fetching data from a database.
$filename = "College_static". $i. ". html";
Gen_static_file ("college_static.php", $filename);
From this function we can see that by calling the function Gen_static_file (), college_static.php has been statically transformed into 33 static pages college.static0.html~ College.static33.html, where $filename will change as $i changes. Of course, can also be directly from the database to control the number of static pages generated and name, other programs to generate static page calls should be consistent with the static page naming rules.
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to email@example.com. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.