First, directly filtered out
$reg = Array ("\ r \ n", "\ n", "\ R");
$replace = ";
$str =str_replace ($reg, $replace, $STR);
So the content will not have to wrap.
Two, become a line wrap
Var_dump ($STR) Print the content out, see in the browser:
String ' Hlmblog This is a magical website
Share It technology and summary
We're all here, and you ' (length=89)
Right click on the mouse click to view the source code of the page:
' Hlmblog This is a magical website & #10;& #10; sharing it technology and summarizing & #10;& #10; we're all here.
which
& #13;& #10; is an escape character for HTML that represents a carriage return line, respectively.
All we have to do is turn the multiple newline escape characters above into one, see the following code:
$str = Preg_replace ("/([\s]{2,})/", "\ n", $str);
Content into the following format, a number of newline successfully converted into a newline, in the mobile phone app and browser can be displayed normally.
1 ' Hlmblog This is a magical website & #10; sharing it technology and summarizing & #10; we're all here.
The browser can parse for <br> or escape tag characters, and if you want to convert the escape line inside the content into <br>, you can
Directly with NL2BR, but mobile phone app does not parse <br>, unless you do transfer processing.
NL2BR ("Hlmblog This is a magical website & #10; sharing it technology and summarizing & #10; we're all here, you.");
The NL2BR () function inserts an HTML newline character (<br>) before each new line (\ n) in the string