简体   繁体   中英

How to add new line break in content-type : text/plain document generated by php?

I want to add a link break in a text file. How do I do that?

My code is as follows.

<?php 
header('Content-Type: text/plain');
?>
Line 1
Line 2
Line 2

I have tried following.

1. echo 'Line'."\n\r"
2. echo nl2br('Line'."\n\r")
3. echo 'Line' . PHP_EOL
4. echo 'Line' . "<br/>"

Nothing is working.

\\n for new line when content-type is text/plain

<br> for new line when content-type is text/html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM