Home > Article > Backend Development > PHP replaces textbox carriage return character with html line break code_PHP tutorial
The source of the Mail Body is sometimes directly the text content in the TextBox. However, if the text content is not processed, the text will have no format, be squeezed together, and displayed line by line. Now we are talking about how to make the text content wrap, so that it will not be crowded together.
During single-step debugging, you will find that in the obtained text content, the newlines in the text have been replaced with "rn". Because this has not been discovered, it has led to a big detour. Now that you have found the reason, you can replace this string with HTML's
.
ex: string strBody = Body.Replace("rn","
");
Although it is very easy, it was really a headache when I didn’t know it at the time. I hope it will be useful to you.
Example
if($_POST){
echo str_replace(chr(13),'
',$_POST['t']);
}
?>
For more details, please check: http://www.bKjia.c0m/phper/29/ff8b04e8f5b663b8b86d960321efcc83.htm