Home > php教程 > php手册 > body text

php读取文件内容至字符串中,同时去除换行、空行、行首行尾空格

WBOY
Release: 2016-06-06 20:41:07
Original
2073 people have browsed it

读取文件内容至字符串中,同时去除换行、行首行尾空格,原理不错,需要的朋友可以参考下

复制代码 代码如下:
//输出:
aaaa,bbbb,cccc,dddd,eeee,ffff,gggg,hhhh,iiii,jjjj,kk kk,ll ll

//file.php内容:
aaaa

cccc
dddd
eeee
ffff
gggg
hhhh
iiii
jjjj
kk kk
ll ll


//file.php替换空格(x)、Tab(T)效果
aaaa

TTTT
cccc
ddddT
xxxxxxxxxxxT
eeeexxxxxxxxxx
ffff
gggg
hhhhxxxxxxxx
xxxxxxxxiiii
xxxxxxxxjjjjxxxxxxx
kkxxxkkTT
xxxxllxxllTT
Txxxxxxxxxx
TTTxx

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!