Php generate static page program-PHP source code

Source: Internet
Author: User
Ec(2);template.html: copy the PHP content to the clipboard. PHP code: & lt ;! DOCTYPEhtmlPUBLIC & quot;-W3CDTDXHTML1.0StrictEN & quot; www. w3.orgTRxhtml1DTDxhtml1-strict. dtd & quot; & gt; & lt; htmlxml script ec (2); script

Template template.html:
Copy the PHP content to the clipboard.
PHP code:




<% {Title }%>


<% {Content }%>


Generate generator. php:
Copy the PHP content to the clipboard.
PHP code:

/*
** Html static page generation module
*/
$ Title = "cShare. ORG Homepage ";
$ Content = "red, green, and blue (cShare. ORG), open source software and free software community. focus on open source software and free software, and strive to promote the development of open source software and free software in China. providing a development platform for software developers and bringing excellent software to users... ";
$ Template = file_get_contents ("template.html"); // read the template
$ Template = str_replace ("<% {title} %>", $ title, $ template); // Replace the tag
$ Template = str_replace ("<%{ content} %>", $ content, $ template );
While (! File_exists ("number.txt") {// if no number file exists, create one and write the initial number 0
File_put_contents ("number.txt", 0 );
}
$ Html_number = file_get_contents ("number.txt ");
$ Html_number ++;
File_put_contents ("number.txt", $ html_number );
$ Html_name = "{$html_number#.html ";
File_put_contents ($ html_name, $ template); // generate a static page
?>

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.