Home >Backend Development >PHP Tutorial >php?去掉空格解决办法

php?去掉空格解决办法

WBOY
WBOYOriginal
2016-06-13 12:26:231241browse

php?去掉空格

<br /> [content_sc] => <br />商号名称(中文): 	有限公司<br />商号名称(英文): 	 <br />商号地址: 	 广州市<br />经营项目: 	金银币,硬币,纸币,邮票,趣味品,茶品<br />联络人姓名(中文): 	张三<br />联络人姓名(英文): 	 <br />电话 	123232328899<br />传真: 	QQ23232370566<br />网址: 	 <br />电邮: 	[email&#160;protected]<br /><br /> $row['content_tc'] = str_replace('	', '', $row['content_tc']);<br />我用str_replace 替换空格,然而并没有什么卵用<br /><br /><br />想要的效果<br /> [content_sc] => <br />商号名称(中文):有限公司<br />商号名称(英文): 	 <br />商号地址:广州市<br />经营项目:金银币,硬币,纸币,邮票,趣味品,茶品<br />联络人姓名(中文):张三<br />联络人姓名(英文): 	 <br />电话:123232328899<br />传真:QQ23232370566<br />网址: <br />电邮: [email&#160;protected]<br />



------解决思路----------------------
foreach ($information as $row) {        <br />        $row['content_tc']=preg_replace("/[ \t]+/", '',$row['content_tc']);<br />        $row['content_tc']=nl2br($row['content_tc']);<br />        $informationAfterHandle[] = $row;<br />}<br />

Statement:
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