首頁  >  文章  >  後端開發  >  php去掉html标签函数代码

php去掉html标签函数代码

WBOY
WBOY原創
2016-07-25 08:54:201215瀏覽
  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标签自动补全的代码



陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn