PHP按行读取文件时如何删除换行符
时间:2021-07-01 10:21:17
帮助过:18人阅读
例子,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);
|