HTML 转 TXT PHP 函数
这个函数我没试过 不知道好不好用
function htmltotxt($document){ $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 ); $text = preg_replace($search, '', $document); return $text; }