Static page-PHP static Web page generation scheme

Source: Internet
Author: User
I would like to add a Web site to export static Web features, what good solution can be quickly exported?

Reply content:

I would like to add a Web site to export static Web features, what good solution can be quickly exported?

Isn't there a function of file_put_content ()?

Need to use the Ob_start () series method,

Simulation requests, such as Curl file_get_contents, are very inefficient and various frameworks are implemented with OB

The phone side of the code word difficult, unknown said

You can look at the output control function in PHP

Why don't you just grab a mirror with wget and hit a tgz pack to download it?

' Ob_start ();
Template processing
echo Template Content
$content = Ob_get_contents ();
Ob_end_clean ();
File_put_contents ('./demo.html ', $content); '

It can also be implemented with the smart template, as shown below:


  
   assign("title","Hello World!");$content = $t->fetch("templates/index.htm");//这里的 fetch() 就是获取输出内容的函数,现在$content变量里面,就是要显示的内容了$fp = fopen("archives/2005/05/19/0001.html", "w");fwrite($fp, $content);fclose($fp);?>

It's also easy to use.


  
   
  • Related Article

    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.