清除字符串中的非普通字符标记函数
时间:2010-04-19 来源:xhq6632
/*去掉字符中全部其他标记*/
function html2txt($document){
$search = array(
'@<script[^>]*?>.*?</script>@si', // Strip out javascript
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments ncluding CDATA
);
$text = preg_replace($search, '', $document);
return $text;
}
function html2txt($document){
$search = array(
'@<script[^>]*?>.*?</script>@si', // Strip out javascript
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments ncluding CDATA
);
$text = preg_replace($search, '', $document);
return $text;
}
相关阅读 更多 +
排行榜 更多 +








![《房产达人2》 v1.11.1.0升级档+未加密补丁[RUNE]](https://images.phpfans.net/img/f1/20251224/logo_694bdc496c5a91.jpg)
![《终结者: 黑暗命运 - 反抗》 v1.08.1158升级档+未加密补丁[RUNE]](https://images.phpfans.net/img/f1/20251224/logo_694bdc464b6c41.jpg)
