/*过滤除img外html标签*/
function cleanhtml($str,$tags='<img><a>'){//过滤时默认保留html中的<a><img>标签
$search = array(
'@<script[^>]*?>.*?</script>@si', // Strip out javascript
/* '@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags*/
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments including CDATA
);
$str = preg_replace($search, '', $str);
$str = strip_tags($str,$tags);
return $str;
}