试图简单地替换一些新的行。已经尝试了3种不同的方式,我没有变化:如何用<br/>替换 r&n?
$description = preg_replace('/\r?\n|\r/','<br/>', $description);
$description = str_replace(array("\r\n","\r","\n"),"<br/>", $description);
$description = nl2br($description);
这些都应该工作,但我仍然得到换行符。他们是双重的:“\ r \ r”。这不应该使这些失败的权利?
为什么你裸'\ r'换行符? AFAIK甚至MacOSX切换到'\ n'。 – ThiefMaster 2011-05-10 06:36:37
他们来自客户的CSV。 – 2011-05-13 22:53:31
[如何从字符串中删除换行符(无字符!)的可能的重复?](http://stackoverflow.com/questions/10757671/how-to-remove-line-breaks-no-characters-from-the -string) – kenorb 2015-03-03 00:28:21