Home > Article > Backend Development > php writes file without overwriting
file_put_contents()
: Write content to the file without overwriting the previous content.
Steps:
1. Create a new file
2. Declare the file to be written into.
3. The content of this file is as shown in the figure
4. file_get_contents reads the content of the file
5. In the file content Then directly write the content to be written and assign it to the variable
6. File_put_contents writes the content
7. Refresh the page and the file content will change
The above content is for reference only!
Recommended tutorial: PHP video tutorial
The above is the detailed content of php writes file without overwriting. For more information, please follow other related articles on the PHP Chinese website!