Home > Backend Development > PHP Tutorial > php file operations

php file operations

巴扎黑
Release: 2016-11-11 11:08:06
Original
1453 people have browsed it

Mode Description

r Open the file as read-only. The file pointer starts at the beginning of the file.

w Open the file for writing only. Delete the contents of the file or create a new file if it does not exist. The file pointer starts at the beginning of the file.

a Open the file for writing only. Existing data in the file will be preserved. The file pointer starts at the end of the file. Create a new file if the file does not exist.

x Create new files as write-only. Returns FALSE and an error if the file already exists.

r+ Open the file for reading/writing, and the file pointer starts at the beginning of the file.

w+ Open the file for reading/writing. Delete the file contents or create a new file if it does not exist. The file pointer starts at the beginning of the file.

a+ Open the file for reading/writing. Data already in the file will be retained. The file pointer starts at the end of the file. Create new file if it does not exist.

x+ Create new files for reading/writing. Returns FALSE and an error if the file already exists.



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