正则

去掉html中的空行

$text = "Line 1

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