第一种:
$content=str_replace(" ","",$content); echo $content; 或者: $content=str_replace(array(" "," "),"",$content);
注:按执行效率,优先建议使用第一种方法
第二种:
$content=preg_replace("/s/","",$content); echo $content;
转:http://blog.csdn.net/ysdaniel/article/details/8056635