这是变量:
$letexts = "Hello this is a sample
after 2 return breaks there is ...
another 3 return breaks";
如您所见,有 2 次返回休息时间,然后是 3 次返回休息时间。我希望能够得到这样的结果:
echo $letexts;
将显示:
Hello this is a sample
after 2 return breaks there is ...
another 3 return breaks
我使用了所有这些并且没有工作,所以它让我拉扯我的头发:
$letexts = preg_replace("/\r\n\s*\r\n/", "\r\n", $letexts);
$letexts = str_replace(array("\r", "\n", "\r\n"), "\r\n", $letexts);
$letexts = trim($letexts);
$letexts = preg_replace('~[\r\n]~','',$letexts);
请问有什么建议吗?