Use php to change an existing dynamic news page to a static page

Source: Internet
Author: User
Use php to change an existing dynamic news page to a static page. when I browse a webpage, I want to generate a corresponding static page under a path on the server for convenient calling, what should I do? <Br/> my program was previously written. when I browse a webpage, I want to generate a corresponding static webpage under a path on the server for convenient calling, what should I do?
This function is not available for my programs. Therefore, I wonder if it is better to implement this function without many changes to the original program.


Reply to: arcow (Chong Xing) (level 5 (intermediate) Credit: 100 18:02:45

For example, if your dynamic display page is

Display. php? Id = 1

Words

You can upload a folder in the diplayinterface to check the ID of the corresponding file. (the folder name is "ID", which is "HTML", "HTML", "2.html", and ,...)
You determine $ id. "html" indicates whether the file exists on the server. if it exists, you can directly jump to this page. if it does not exist, you can create the file. (a function is used to create the file. This makes little changes 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) reputation: 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 ();
$ Fp = fopen ($ _ GET ['id']. ". htm", "w ");
Fwrite ($ fp, $ html );
Fclose ($ fp );

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.