How can I read a .txt
file from my server, and preserve it\'s linebreaks?
Note that the linebreaks aren\'t like this /n
or something, they are more
The line breaks are preserved without you needing to do anything. You can easily verify this by running the code from the command line, for example with
php -r "readfile('text.txt');"
However, in HTML whitespace is collapsed by default. If you want to preserve it use the CSS white-space attribute like this: