Home > Article > Backend Development > How to write newline to file in php
The way PHP writes files with line breaks
It is not possible to add "\r\n" directly after the string;
Just add ."\r\n" after writing the variable $filename
file_put_contents($filelist, $filename."\r\n",FILE_APPEND);
Recommended tutorial: "PHP Tutorial"
The above is the detailed content of How to write newline to file in php. For more information, please follow other related articles on the PHP Chinese website!