Home > Backend Development > PHP Tutorial > Simple method to read and write files in PHP_PHP Tutorial

Simple method to read and write files in PHP_PHP Tutorial

WBOY
Release: 2016-07-13 10:26:44
Original
1022 people have browsed it

Read the file contents and write to the variable $contents:  

Write the contents of the variable $contents to the file:

Of course, we can also use file_get_contents and file_put_contents to read and write files.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/822517.htmlTechArticleRead the file contents and write to the variable $contents: ?php $fp=fopen('file.txt', 'r'); $contents=fread($fp,filesize('file.txt')); fclose($fp); ? Write the contents of the variable $contents to the 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