I\'m trying to open a text file and output its contents with the code below. The text file includes line breaks but when I echo the file its unformatted. How do I fix this?<
Say you have an index.php file hosted by the web server. You want to insert some multi-line text file contents into it. That's how you do it:
Some multi-line message below:
= nl2br(file_get_contents('message.txt.asc')); ?>
This = ... ?> part is just a shorthand, which instructs the web server, that it needs to be treated as a PHP echo argument.