php能过滤掉 没有内容的标签吗,比如把他</p><p></p><strong>敬茶需用好茶</strong><p></p>
过滤成这样</p><strong>敬茶需用好茶</strong>
//preg_replace("/<(\w+)><\/\\1>/", "", $str);
$str = "</p><p></p><strong>敬茶需用好茶</strong><p></p>";
$result = preg_replace("/<(\w+)><\/\\1>/", "", $str);
echo $result;
//img标签后面增加<br>
echo preg_replace("/(<img[^>]*\/>)/", "\\1<br>", $str);