我无法使用以下任何方法从文本区域中删除这些"\r\n\r\n“
Good job overall!\r\n\r\n*********************************************************************** \r\n\r\nSoft skills: Please don\'t forget to ask customers for the reason of cancellation.

methods
$resolution = trim($resolution);
//Effort 2
$resolution = nl2br($resolution);
//Effort 3
$resolution = htmlentities($resolution);
//Effort 4
$resolution = preg_replace("\\r\\n","<br>",$resolution);
$snip = str_replace("\t", '', $snip); // remove tabs
$snip = str_replace("\n", '', $snip); // remove new lines
$snip = str_replace("\r", '', $snip); // remove carriage returns
Array( =>阵列( field_id => 5497类型=> F parent_id => 0 field_type => field_name => Retention Offered?required => 1 maxlength => 0 field_value => YES not_applicable => on (所需的最大长度为0=>not_applicable=>on)
[1] => Array
(
[field_id] => 5494
[type] => F
[parent_id] => 0
[field_type] => textarea
[field_name] => Summary of Interaction
[required] => 1
[maxlength] => 0
[field_value] => Cx requested cancel, agent secured and explained account, offered rates, cx declined, agent confirmed cancellation
[not_applicable] => on
)
[2] => Array
(
[field_id] => 5495
[type] => F
[parent_id] => 0
[field_type] => textarea
[field_name] => Feedback
[required] => 0
[maxlength] => 0
[field_value] => Good job overall!\r\n\r\n*********************************************************************** \r\n\r\nSoft skills: Please don\'t forget to ask customers for the reason of cancellation.
[not_applicable] => on
))
发布于 2018-10-24 18:29:20
用户preg_replace,要从字符串中删除\n\r,请遵循以下代码
$title = "Good job overall!\r\n\r\n*********************************************************************** \r\n\r\nSoft skills: Please don't forget to ask customers for the reason of cancellation";
$new_title = preg_replace("/[\n\r]/","",$title);
echo $new_title;发布于 2018-10-24 19:20:41
我使用了下面的代码( '\t','\n','\r‘),只是使用了单引号而不是双引号
$snip = str_replace('\t', '', $snip); // remove tabs
$snip = str_replace('\n', '', $snip); // remove new lines
$snip = str_replace('\r', '', $snip); // remove carriage returnshttps://stackoverflow.com/questions/52966614
复制相似问题