//php 有三种方法来解决 
  
//1、使用str_replace 来替换换行 
$str = str_replace(array("\r\n", "\r", "\n"), "", $str); 
  
//2、使用正则替换 
$str = preg_replace('//s*/', '', $str); 
  
//3、使用php定义好的变量 (建议使用) 
$str = str_replace(PHP_EOL, '', $str);
// 转为前台可显示的换行, nl2br 的方向函数参考php手册
$str = "a
b
e
f
c";

echo nl2br($str);

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2021-11-13
  • 2021-07-29
  • 2022-01-19
  • 2021-08-25
猜你喜欢
  • 2022-03-03
  • 2022-01-29
  • 2022-02-18
  • 2022-01-27
  • 2022-01-08
  • 2023-04-03
相关资源
相似解决方案