Home > Article > Backend Development > What is a php file? PHP introductory learning knowledge point 6. The reading and writing operation code of PHP files
Copy the code The code is as follows:
//Open the file
$fp=fopen('tmp.html', 'r');
//You can use the following two methods to read the file content Function to operate fread, file_get_contents
$str=fread($fp, filesize('tmp.html')); //filesize is to get the file size
$c
//Write the file
$news=fopen('news. html', 'w');
fwrite($news, $content);
//Close the file stream
fclose($fp);
fclose($news);
echo $content;
?>
The above introduces what kind of file php is. Knowledge point 6 for introductory learning of php. The code for reading and writing PHP files, including what kind of file php is. I hope it will be helpful to friends who are interested in PHP tutorials.