如$str=" 沃尔克 · 布鲁赫 ";
怎样过滤掉(沃尔克 · 布鲁赫)前面与后面的空格,保留中间部分的空格。
str_replace( " ", " ",$str);
echo preg_replace('/^\s+|\s+$/','',$str); $str=" 沃尔克 · 布鲁赫 ";
echo trim($str);
$str=" 沃尔克 · 布鲁赫 ";
echo trim($str); +1
$str=" 沃尔克 · 布鲁赫 ";
echo trim($str);
trim是删除两端的吧
PHP trim() 函数
http://www.w3school.com.cn/php/func_string_trim.asp
可以去除首尾空格
$str=" 沃尔克 · 布鲁赫 ";
echo trim($str);
trim是删除两端的吧
是的。
过滤掉(沃尔克 · 布鲁赫)前面与后面的空格,保留中间部分的空格。 就是过滤两端的意思。
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号