Fork me on GitHub

去掉所有的html标签

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

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

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

preg_replace("/(\s|\&nbsp\;| |\xc2\xa0)/", "", strip_tags($str));

posted @ 2016-01-08 15:29  我曾如此奢望  阅读(178)  评论(0编辑  收藏  举报