PHP introductory learning knowledge point 6: Reading and writing operation codes for PHP files_PHP tutorial

WBOY
Release: 2016-07-21 15:27:12
Original
724 people have browsed it

Copy the code The code is as follows:

//Open the file
$fp=fopen('tmp .html', 'r');
//Reading file contents can be operated with the following two functions fread, file_get_contents
$str=fread($fp, filesize('tmp.html')); //filesize is to get the file size
$content=file_get_contents('tmp.html');
//Write file
$news=fopen('news.html', 'w');
fwrite($news, $content);
//Close the file stream
fclose($fp);
fclose($news);
echo $content;
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/323823.htmlTechArticleCopy the code as follows: ?php //Open the file $fp=fopen('tmp.html', 'r '); //Reading file contents can be operated with the following two functions fread, file_get_contents $str=fread($fp, file...
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