PHP reads the file content into a string and removes newlines, blank lines, and spaces at the beginning and end of the line (Zjmainstay original)_PHP tutorial

WBOY
Release: 2016-07-21 15:16:58
Original
1121 people have browsed it

Copy code The code is as follows:

//Output:
aaaa,bbbb,cccc,dddd,eeee,ffff,gggg,hhhh,iiii,jjjj,kk kk,ll ll

//file.php content:
aaaa

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


//file.php replace space (x), Tab (T) effect
aaaa

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/325785.htmlTechArticleCopy the code as follows: ?php /* *Read the file content into a string, and remove newlines and lines at the same time Trailing space on first line. */ header("Content-type: text/html; charset=utf-8"); echo preg_re...
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 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!