php删除字符串中的空格的方法:首先创建一个PHP示例文件;然后通过“function trimall($str){$qian=array(" "," ","\\t","\\n","\\r");}”方法删除字符串中的空格即可。
推荐:《PHP视频教程》
php删除字符串中的所有空格
其实是对trim函数的扩展
trim只能删除字符串两边的空格
php代码
function trimall($str)//删除空格 { $qian=array(" "," ","\\t","\\n","\\r"); $hou=array("","","","",""); return str_replace($qian,$hou,$str); }