我有一个帖子表单,它将我的文本插入MySQL数据库.
我用
$post_text = mysql_real_escape_string(htmlspecialchars($_POST['text']));
Run Code Online (Sandbox Code Playgroud)
并想要替换\r\n自动添加的内容.
我试过了
$text = str_replace('\\r\\n','', $text);
$text = str_replace('\r\n','', $text);
$text = str_replace('\\R\\N','', $text);
$text = str_replace('\R\N','', $text);
$text = str_replace('/\r\\n','', $text);
$text = str_replace('/r/n','', $text);
$text = str_replace('/\R\\N','', $text);
$text = str_replace('/R/N','', $text);
Run Code Online (Sandbox Code Playgroud)
但\r\n始终包含在我的数据库条目中.
我怎样才能解决这个问题?