Home > Backend Development > PHP Tutorial > 如何去掉字符串的换行,tab 特殊字符

如何去掉字符串的换行,tab 特殊字符

WBOY
Release: 2016-06-13 12:53:16
Original
1095 people have browsed it

怎么去掉字符串的换行,tab 特殊字符?
怎么去掉字符串的换行,tab 特殊字符?


------解决方案--------------------
str_replace('\n','',$content);
str_replace('\r','',$content);
str_replace('\t','',$content);
------解决方案--------------------
$s='aa	bb<br />
cc';<br />
echo preg_replace('/\s+/','',$s);
Copy after login

aabbcc
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template