Plan to use php to change an existing dynamic message page to a static page
Source: Internet
Author: User
When I browse a webpage, I want to create a static webpage under a path on the server for convenient calling. how can this problem be solved? When I browse a webpage, I want to create a static webpage under a path on the server for convenient calling. how can this problem be solved?
I did not have this function because my program was previously written. Therefore, I wonder if it is better to achieve this function without having to make a large number of corrections to the original program.
You can check whether there is a file name with the corresponding id in the corresponding directory in the diplay file (assume that the file is the id: HTML, 1.html, 2.html ,...)
You determine $ id. whether the 'HTML 'file exists on the server. if it exists, it will jump directly to the page. if it does not exist, it will be created (a function is used to create the file. This makes little modification to the page, for example, createHTML ($ _ GET ['id']), as to how to write this function, I think you should know) and then jump
-------------------------------------------------
Reply to: ice_berg16 (Scarecrow for dream searching) (Samsung (advanced) Credit: 125 21:33:13
Assume that the document page is
ShowNews. php? Id = 34
You can do this.
Ob_start ();
// Your normal program code
$ Html = ob_get_contents ();
Ob_end_clean ();
Using fp1_fopen(1__get1_'id'0000.'.htm', 'w ');
Fwrite ($ fp, $ html );
Fclose ($ fp );
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