最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php 过滤所有HTML标记
时间:2010-09-03 编辑:简简单单 来源:一聚教程网
//去除html标记
代码如下 | 复制代码 |
function text2html($txt){ $txt = str_replace(" "," ",$txt); $txt = str_replace("<","<",$txt); $txt = str_replace(">",">",$txt); $txt = preg_replace("/[ ]{1,}/isu"," ",$txt); return $txt; } |
//清除html标记
代码如下 | 复制代码 |
function clearhtml($str){ $str = str_replace('<','<',$str); $str = str_replace('>','>',$str); return $str; } |
-
上一个: php获取上传文件类型 获取文件后缀
-
下一个: php正则链接-取得内容所有链接
相关文章
- PHP下使用富文本过滤器 HTML Purifier 防止xss跨站攻击 02-02
- php 过滤所有html标签 01-15
- php过滤所有html标签的几种方法 06-19
- PHP技巧:php过滤危险html代码 04-24
- PHP导出数据超时的优化建议解读 10-31
- PHP之mysql位运算解析 10-31