How does PHP output line breaks?

Source: Internet
Author: User
How does PHP output line breaks? PHP outputs the html source code, because many of them do not have line breaks when viewing the source code! Source code line feed! How to output line breaks? The server is win! Also ask how to output in linux, windows \ r \ n \ r is the carriage return character linux \ n, discuss windows \ r \ n \ r is the carriage return character linux \ n, how does ech PHP output line breaks?
PHP outputs the html source code, because many of them do not have line breaks when viewing the source code!


Source code line feed!

How to output line breaks?

The server is win! Also ask how to output in linux

------ Solution --------------------
Windows \ r \ n \ r is the carriage return.
Linux \ n
------ Solution --------------------
Discussion
Windows \ r \ n \ r is the carriage return.
Linux \ n

------ Solution --------------------
Echo"
";
Echo"

";
Echo "\ n ";

------ Solution --------------------
View the html source code. use
This is also good. 


------ Solution --------------------
Echo "\ n" is used for line feed when HTML code is output"

Echo"
"
------ Solution --------------------
\ N.

\ R \ n in Windows
\ N in Linux/UNIX
\ R for Mac
------ Solution --------------------
PHP code
Echo "\ n"
------ Solution --------------------
Process the data you want to output before outputting it.

Function strip_textarea ($ string)
{
Return nl2br (str_replace ('','', htmlspecialchars ($ string, ENT_QUOTES )));
}

Or the function opposite to nl2br. you can check the manual.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.