当用户输入数据时,我使用mysqli_real_escape_string(),我有一个私有消息传递系统,他们输入的每一条消息都使用该函数进行转义。现在,输入的数据是文本,并保存到数据库中。所以当我从数据库中检索并回显它时,它会在其中放上反斜杠和某些字母。比如说..。
Here's a couple...not sure which one will work best though...显示为.。
Here\'s a couple...not sure which one will work best though...\r\n\r\如何防止斜杠和r/n字母的出现?
Stripslashes()将其更改为.
Here's a couple...not sure which one will work best though...rnrn我还需要信去
发布于 2015-03-23 13:34:10
发布于 2015-03-23 14:09:07
使用带strip斜杠()的nl2br()
nl2br -在字符串中的所有换行符之前插入HTML行。
nl2br(stripslashes($result));它将返回字符串,在所有换行符(\r\n、\n\r、\n和\r)之前插入<br />或<br>。
https://stackoverflow.com/questions/29211566
复制相似问题