对分享一个php清除html标签的函数感兴趣的小伙伴,下面一起跟随脚本之家 jb51.cc的小编两巴掌来看看吧! 分享一个php清除html标签的函数,用于清除不需要的html标签格式
/**
* 分享一个php清除html标签的函数
*
* @param
* @arrange 512-笔记网: jb51.cc
**/
function strip_html_tags( $text )
{
$text = preg_replace(
array(
// Remove invisible content
'@<head[^>]*?>.*?</head>@siu','@<style[^>]*?>.*?</style>@siu','@<script[^>]*?.*?</script>@siu','@<object[^>]*?.*?</object>@siu','@<embed[^>]*?.*?</embed>@siu','@<applet[^>]*?.*?</applet>@siu','@<noframes[^>]*?.*?</noframes>@siu','@<noscript[^>]*?.*?</noscript>@siu','@<noembed[^>]*?.*?</noembed>@siu',// Add line breaks before and after blocks
'@</?((address)|(blockquote)|(center)|(del))@iu','@</?((div)|(h[1-9])|(ins)|(isindex)|(p)|(pre))@iu','@</?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu','@</?((table)|(th)|(td)|(caption))@iu','@</?((form)|(button)|(fieldset)|(legend)|(input))@iu','@</?((label)|(select)|(optgroup)|(option)|(textarea))@iu','@</?((frameset)|(frame)|(iframe))@iu',),array(
' ',' ',"
$0",$text );
}
/*** 来自脚本之家 jb51.cc(jb51.cc) ***/
(编辑:安卓应用网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|