作者:桦林ye家伟 | 来源:互联网 | 2023-05-17 13:08
PHP在不同的系统中,换行是不同的Linux:Windows:mac: 所以去除回车换行的方法:1.使用php定义好的变量(比较好的方法,推荐)$str str_replace(
PHP在不同的系统中,换行是不同的
Linux:\n
Windows:\r\n
mac:\r
所以去除回车换行的方法:
1.使用php定义好的变量(比较好的方法,推荐)
$str= str_replace(PHP_EOL, '', $str);
2.使用str_replace 来替换换行
$str= str_replace(array("\r\n", "\r", "\n"), "", $str);