去掉所有的html标签

去掉所有的HTML标签:
$text=preg_replace('/<[^>]+>/','',$text);

去掉<img>标签:
$text=preg_replace('/<img[^>]+>/i','',$text);

//正则表达式去除所有空格和html标签(包括换行 空格 &nbsp;)

preg_replace("/(s|&nbsp;| |xc2xa0)/", "", strip_tags($str));

原文地址:https://www.cnblogs.com/yaoyao1556/p/5113384.html