When we use textarea, we will find that the carriage return and the space are not visible, so we use the Str_replace function to replace the \ n in PHP to BR is OK. If you need a friend, you can refer to it.
| The code is as follows |
Copy Code |
|
function Htmtocode ($content) {
$content = Str_replace ("n", "
", Str_replace (" "," ", $content));
return $content;
} |
Replace the blank space before replacing the carriage return.
Equivalent:
| The code is as follows |
Copy Code |
function Htmtocode ($content) {
$content = Str_replace ("", "" ", $content);
$content = Str_replace ("n", "
", $content);
return $content;
} |
http://www.bkjia.com/PHPjc/445331.html www.bkjia.com true http://www.bkjia.com/PHPjc/445331.html techarticle when we use textarea, we will find that the carriage return and the space are not visible, so we use the Str_replace function to replace the \ n in PHP to BR is OK. If you need a friend, you can refer to it. to be a substitute for ...