php去掉html标记保留文字内容函数

项目需要,所以自己写了一个,感觉还不错www.yiyou.org

function ClearHtml($content) {
    $content = preg_replace("/<\w+>/i", "", $content);
    $content = preg_replace("/<\w+[^>]*>/i", "", $content); 
    $content = preg_replace("/<\/\w+>/i", "", $content);
    return $content;
}