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
?>