Home > Article > Backend Development > php file operations
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. |
The above introduces the operation of PHP files, including aspects of content. I hope it will be helpful to friends who are interested in PHP tutorials.