怎么去掉字符串首尾部一个或多个换行符
怎么去掉字符串尾部一个或多个换行符
$str=“
文字
“;
$str=preg_replace(“/^[
]+|[
]+$/”2本文来源gaodaima#com搞(代@码$网6
搞gaodaima代码
,””,$str);
怎么写才正确?
——解决方案——————–
$str = str_replace(‘
‘,”,$str);
——解决方案——————–
- PHP code
<?php$str=<<<HTML文
字HTML;echo preg_replace('/(^(
\s*)+)|((
\s*)+$)/is','',$str);