时间:2021-07-01 10:21:17 帮助过:19人阅读
输出:
$str = " Hello World! ";
echo "Without trim: " . $str;
echo "
";
echo "With trim: " . trim($str);
?>
Without trim: Hello World!
With trim: Hello World!HTML 源码:
例子 2
代码如下:输出:
$str = "\r\nHello World!\r\n";
echo "Without trim: " . $str;
echo "
";
echo "With trim: " . trim($str);
?>
Without trim: Hello World!
With trim: Hello World!HTMLhttp://www.bkjia.com/PHPjc/318090.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/318090.htmlTechArticle去掉前后的空格. 假设有一个字符串"dddddd",经过Trim()之后成为"dddddd". 如上可以去掉两边多余的空格(包括制表符),但不能去掉中间的空格...