Home > Backend Development > PHP Tutorial > How to read and write files in PHP (generate HTML)_PHP tutorial

How to read and write files in PHP (generate HTML)_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 16:00:12
Original
828 people have browsed it

//Generate HTML
$countfile="template.html";
$num=file_get_contents($countfile);
echo $num;
$num=str_replace( "|*|*|PAGE_TITLE|*|*|","myhome",$num);
$path="template.html";
$handle=fopen($path,"w"); //Open the news path in writing mode
fwrite($handle,$num); //Write the replaced content into the generated HTML file
fclose($handle);
?>
file_get_contents -- Read the entire file into a string
file -- Read the entire file into an array

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/317188.htmlTechArticle?php //Generate HTML $countfile="template.html"; $num=file_get_contents($countfile); echo$num; $num=str_replace("|*|*|PAGE_TITLE|*|*|","myhome",$num); $path="template.html"; $handle=fo...
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template