PHP去除字符串的前后空格 0 By 董德多 on 2021年8月27日 PHP 1、使用trim()函数去掉空格 trim($val) 2、使用正则表达式去掉空格 preg_replace(' ','',$val) PHP trim 字符串 空格