技术支持
php怎么去掉字库串空格

$postField = 'user_name,password,passwordb,email';  

$data = $this->request->only(explode(',',$postField),'post',null);

$data['user_name']=trim($data['user_name']);  //去掉头尾空格

$data['user_name']=str_replace(' ','',$data['user_name']);//去掉中间有些空格。


主要用到:trim  和str_replace 

也可以定义一个function()以便以后用。

====

function dellspace($str){

  $str=trim($str);

  $str=str_replace(' ','',$str);

  return $str;

  }




常见问题
实用工具
应用教程
公众号
微信号
关于我们|新闻中心|资质荣誉|网站地图|友情链接|加入我们|联系我们

网站ICP备案:粤ICP备19128440号-1 服务电话:0755-33123228
Copyright©1993-2020 深圳市栩侨科技有限公司 版权所有