文字去除空格

浏览548

trimall()   文字去除空格


$content=str_replace(array("\r\n", "\r", "\n"), '<br/>', $content);

换行("\r\n")出现一个“\r”或者“\n”就加一个'<br />'



换行符,手机编辑没有换行,空格没有,


$content=str_replace(array(" "," ","\t"), '&nbsp;', $content); 

如果传过来的数据中有空格就替换为 '&nbsp;' " "前一个代表键盘空格," "代表Tab空格



$content    代表前台传过来的内容

  • 暂无任何回答