PHP writes a string to the TXT file, with a newline problem
$DOCUMENTROOT = $_server[' document_root ');
$file = fopen ("$DOCUMENTROOT/php_02/123.txt", "WB");
Fwrite ($file, "Line 1". " \ n "." Line 2 N line 3 ");
Fclose ($file);
It's useless.
But
$DOCUMENTROOT = $_server[' document_root ');
$file = fopen ("$DOCUMENTROOT/php_02/123.txt", "WB");
Fwrite ($file, "Line 1". " \ r \ n "." Line 2, Line 3 ");
Fclose ($file);
That's it, ask why.
------Solution--------------------
Different editor parsing effect is different
Open the following two programs in the command line, and then open the generated file with the program, you can see how the program resolves \ n
Notepad
WordPad
Many editors in Windows put \ r \ nthe line, ignoring \ n
You turn the Word Display control character function on, \ n appears as a downward arrow, \ r \ n the arrow that appears as a corner
------Solution--------------------
Window \ r \ n
Linux \ n