Home  >  Article  >  Backend Development  >  php file operations

php file operations

巴扎黑
巴扎黑Original
2016-11-11 11:08:061432browse

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.



Statement:
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