When we use textarea, we will find that carriage returns and spaces are not visible, so we use the str_replace function to replace \n in php with br. Friends in need can refer to it. The code is as follows:
function htmtocode ($content) {
$content = str_replace("n", "
", str_replace(" ", " ", $content));
return $content;
}
Replace it first Space, then replace the carriage return, which is equivalent to the following code:
function htmtocode($content) {
$content = str_replace(" ", " ", $content);
$content = str_replace("n", "
",$content);
return $content;
//Open source code phpfensi.com
}