php去除html
2014-02-20 16:15
176 查看
代码如下
//清除html function clearhtml($str){ $str = trim($str); $str = strip_tags($str,""); $str=strip_tags($str,"");//利用php自带的函数清除html格式 $str=preg_replace("/\t/","",$str);//使用正则表达式匹配需要替换的内容,如空格和换行,并将替换为空 $str=preg_replace("/\r\n/","",$str); $str=preg_replace("/\r/","",$str); $str=preg_replace("/\n/","",$str); $str=preg_replace("/ /","",$str);//匹配html中的空格 $str=preg_replace("/ /","",$str);//匹配html中的空格 return trim($str); }
相关文章推荐
- php strip_tags() 函数去除 HTML、XML 以及 PHP 的标签。
- php去除HTML标签实例
- php 去除html标记-strip_tags和htmlspecialchars的区别
- php 去除html标签 和 css样式
- PHP strip_tags()去除HTML、XML以及PHP的标签介绍
- PHP 去除 HTML 回车 换行 空格
- PHP 去除多余的HTML标签
- PHP分页、防止英文单词被截段、去除HTML代码
- 实用的php清除html,php去除空格与换行,php清除空白行和换行,提取页面纯文本
- PHP中strip_tags() 函数的使用方法和介绍,去除字符串中的HTML标签等
- php中去除所有js,html,css代码
- php中去除文字内容中所有html代码
- php 去除html标记--strip_tags与htmlspecialchars的区别详解
- php去除、去掉html标签函数strip_tags
- php里去除html标记的函数
- php去除HTML标记
- php去除html中的script
- 去除html和php标记的方法--strip_tags
- php去除html标签并截取中文字符
- php 去除html标记--strip_tags与htmlspecialchars的区别详解