简体   繁体   English

\\ r \\ n \\ r \\ n字符串进入纯文本

[英]\r\n\r\n Strings Getting Into Plain Text

I am facing an issue of using form input that I need to send as a text email and then put into the database. 我正面临使用表单输入的问题,我需要将其作为文本电子邮件发送,然后放入数据库。

When I send it as a text email, the newline characters show up as \\r\\n\\r\\n in the plain text email, but do not show up like that when stored in the DB. 当我将其作为文本电子邮件发送时,换行符在纯文本电子邮件中显示为\\ r \\ n \\ r \\ n,但在存储在数据库中时不会显示。

I am using PHP/MySQL - what would be the fix to stop the \\r\\n\\r\\n characters from showing up in the email that gets sent out? 我正在使用PHP / MySQL - 什么是阻止\\ r \\ n \\ r \\ n字符显示在发送的电子邮件中的修复?

Thank you, Alex 谢谢,Alex

A possible cause of this might be database sanitizing (like mysqli_real_escape_string). 造成这种情况的可能原因是数据库清理(例如mysqli_real_escape_string)。 I've done the same mistake by systematically sanitizing even variables that were never passed to the database. 通过系统清除甚至从未传递到数据库的变量,我犯了同样的错误。

send the email as text/html and use 将文件发送为text / html并使用

<p> or <br>

tags 标签

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM