php读取文件内容至字符串中,同时去除换行、空行、行首行尾空格(Zjmainstay原创)
<?php /* *读取文件内容至字符串中,同时去除换行、行首行尾空格。 */ header("content-type: text/html; charset=utf-8"); echo preg_replace('/((\s)*(\n)+(\s)*)/i',',',file_get_contents('./file.php'));//end_php
//输出:
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
如对本文有疑问,
点击进行留言回复!!
相关文章:
-
-
-
-
网安追踪流程
1.不用代理网民发帖流程:发帖人 → ISP → 服务器托管商 → 服务器网警追踪流程:网监 → 服务器IP →...
[阅读全文]
-
-
-
HTTP状态码大全
转自:https://www.cnblogs.com/lxinxuan/archive/2009/10/22/1...
[阅读全文]
-
-
-
-
网友评论