怎么去掉字符串尾部一个或多个换行符<br />$str=“<br /> <br /> <br />文字<br /><br />
<br />
<br /><br /><br />";$str=preg_replace("/^[<br \/>]+|[<br \/>]+$/","",$str);
怎么写才正确?
<br />
<br /><br /><br />";$str=preg_replace("/^[<br \/>]+|[<br \/>]+$/","",$str);
怎么写才正确?
<br />
<br /><br /><br />";$str=preg_replace("/^[<br \/>]+|[<br \/>]+$/","",$str);
怎么写才正确?结果为
$str="文<br />字"
$str=<<<HTML
<br /> <br /> <br />文<br />字<br /><br />
<br />
<br /><br /><br />
HTML;
echo preg_replace('/(^(<br\s+\/>\s*)+)|((<br\s+\/>\s*)+$)/is','',$str);
去尾部 '/(<br\s+\/>\s*)+$/is'