php去掉html标签函数代码

WBOY
发布: 2016-07-25 08:54:20
原创
1195 人浏览过
  1. function noHTML($content)
  2. {
  3. $content = preg_replace("/]*>/i",'', $content);
  4. $content = preg_replace("//i", '', $content);
  5. $content = preg_replace("/
    ]*>/i",'', $content);
  6. $content = preg_replace("//i",'', $content);
  7. $content = preg_replace("/]*>/i",'', $content);
  8. $content = preg_replace("//i",'', $content);
  9. $content = preg_replace("/

    ]*>/i",'', $content);

  10. $content = preg_replace("//i",'', $content);
  11. $content = preg_replace("/]*>/i",'', $content);
  12. $content = preg_replace("//i",'', $content);
  13. $content = preg_replace("/]*>/i",'', $content);
  14. $content = preg_replace("//i",'', $content);
  15. $content = preg_replace("/

    ]*>/i",'', $content);

  16. $content = preg_replace("//i",'', $content);
  17. $content = preg_replace("/]*>/i",'', $content);
  18. $content = preg_replace("//i",'', $content);
  19. $content = preg_replace("/]*>/i",'', $content);
  20. $content = preg_replace("//i",'', $content);
  21. $content = preg_replace("/]*>/i",'', $content);
  22. $content = preg_replace("//i",'', $content);
  23. $content = preg_replace("//i",'', $content);//注释内容
  24. $content = preg_replace("/

    ]*-->/i",'', $content);//注释内容

  25. $content = preg_replace("/style=.+?['|\"]/i",'',$content);//去除样式
  26. $content = preg_replace("/class=.+?['|\"]/i",'',$content);//去除样式
  27. $content = preg_replace("/id=.+?['|\"]/i",'',$content);//去除样式
  28. $content = preg_replace("/lang=.+?['|\"]/i",'',$content);//去除样式
  29. $content = preg_replace("/width=.+?['|\"]/i",'',$content);//去除样式
  30. $content = preg_replace("/height=.+?['|\"]/i",'',$content);//去除样式
  31. $content = preg_replace("/border=.+?['|\"]/i",'',$content);//去除样式
  32. $content = preg_replace("/face=.+?['|\"]/i",'',$content);//去除样式
  33. $content = preg_replace("/face=.+?['|\"]/",'',$content);
  34. $content = preg_replace("/face=.+?['|\"]/",'',$content);
  35. $content=str_replace( " ","",$content);
  36. return $content;
  37. }
复制代码

>>> 您可能感兴趣的文章: PHP删除html标签的代码 php 判断字符串是否包含html标签 提取html标签的php代码示例 php提取HTML标签的方法举例 php去除HTML标签的二种方法 php 去除多余的HTML标签 php正则 查找html中包含id属性的html标签 php用strip_tags完整去除所有html标签的实例分享 php删除html标签的三种方法分享 php删除html标签及字符串中html标签的代码 php删除字符串中html标签的函数 提取html标签的php代码 php正则过滤html标签、空格、换行符等的代码示例 修复未正常关闭的HTML标签(支持嵌套和就近闭合)的代码 php去除html标签获得输入纯文本文档strip_tags php使HTML标签自动补全闭合函数的代码 php实现html标签自动补全的代码



来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!