相关疑难解决方法(0)

用PHP替换\ r \n

我有一个帖子表单,它将我的文本插入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始终包含在我的数据库条目中.

我怎样才能解决这个问题?

php mysql replace insert

34
推荐指数
3
解决办法
6万
查看次数

标签 统计

insert ×1

mysql ×1

php ×1

replace ×1