正则

去掉html中的空行

$text = "Line 1

Line 3";
$text = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $text);
echo $text;
最后修改:2024 年 01 月 22 日
如果觉得我的文章对你有用,请随意赞赏