您的位置:首页 > 编程语言 > PHP开发

PHP按行读取文件时删除换行符的3种方法

2014-05-04 00:00 826 查看
PHP按行读取文件 去掉换行符”\n”:

第一种:
$content=str_replace("\n","",$content);
echo $content;

或者:
$content=str_replace(array("\n","\r"),"",$content);

第二种:
$content=preg_replace("/\s/","",$content);

echo $content;
第三种:
$content=trim($content);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: