Home > Backend Development > PHP Tutorial > Simple method to generate static HTML page with PHP html code html5 tutorial html space

Simple method to generate static HTML page with PHP html code html5 tutorial html space

WBOY
Release: 2016-07-29 08:51:17
Original
1275 people have browsed it

PHP file name: dome.php

<code><span><?php</span><span>$string</span> = <span>1</span>;
    ob_start();
    @readfile(<span>"templets/list.html"</span>);
    <span>$text</span> = ob_get_flush();
    <span>$myfile</span> = fopen(<span>"list.html"</span>,<span>"w"</span>);
    <span>$text</span> = str_replace (<span>"{counent}"</span>,<span>$string</span>,<span>$text</span>);
    fwrite(<span>$myfile</span>,<span>$text</span>);
    ob_clean();
<span>?></span></code>
Copy after login

Template file name: templets/list.html

<code><span><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"></span><span><<span>html</span>></span><span><<span>head</span>></span><span><<span>meta</span><span>http-equiv</span>=<span>"Content-Type"</span><span>content</span>=<span>"text/html; charset=UTF-8"</span>></span><span><<span>title</span>></span>Insert title here<span></<span>title</span>></span><span></<span>head</span>></span><span><<span>body</span>></span><span></<span>body</span>></span><span><<span>table</span><span>width</span>=<span>"500"</span><span>border</span>=<span>"0"</span><span>cellpadding</span>=<span>"5"</span><span>cellspacing</span>=<span>"1"</span><span>align</span>=<span>"center"</span><span>bgcolor</span>=<span>"#add3ef"</span>></span><span><<span>tr</span><span>bgcolor</span>=<span>"#eff3ff"</span>></span><span><<span>td</span>></span>用户:{counent_user}  标题:{counent_title}  发布时间:{counent_lastdate}<span></<span>td</span>></span><span></<span>tr</span>></span><span><<span>tr</span><span>bgcolor</span>=<span>"#fff"</span>></span><span><<span>td</span>></span>内容:{counent_content}<span></<span>td</span>></span><span></<span>tr</span>></span><span></<span>table</span>></span><span></<span>form</span>></span><span></<span>html</span>></span></code>
Copy after login

http://blog.csdn.net/leedaning/article/details/48088863

').addClass( 'pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces a simple method for generating static HTML pages in PHP, including HTML content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template