Home > Backend Development > PHP Tutorial > PHP remove html tag function code

PHP remove html tag function code

WBOY
Release: 2016-07-25 08:54:20
Original
1231 people have browsed it
  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);
  • $content = preg_replace("/]*>/i",'', $content);
  • $content = preg_replace("//i",'', $content);
  • $content = preg_replace("/]*>/i",'', $content);
  • $content = preg_replace("/

    /i",'', $content);
  • $content = preg_replace("/]*>/i",'', $content);
  • $content = preg_replace("//i",'', $content);
  • $content = preg_replace("/]*>/i",'', $content);
  • $content = preg_replace("//i",'', $content);
  • $content = preg_replace("/]*>/i",'', $content);
  • $content = preg_replace("//i",'', $content);
  • $content = preg_replace("/]*>/i",'', $content);
  • $content = preg_replace("//i",'', $content);
  • $content = preg_replace("/]*>/i",'', $content);
  • $content = preg_replace("//i",'', $content);
  • $content = preg_replace("/]*>/i",'', $content);
  • $content = preg_replace("//i",'', $content);
  • $content = preg_replace("//i",'', $content);//注释内容
  • $content = preg_replace("/]*-->/i",'', $content);//注释内容
  • $content = preg_replace("/style=.+?['|"]/i",'',$content);//去除样式
  • $content = preg_replace("/class=.+?['|"]/i",'',$content);//去除样式
  • $content = preg_replace("/id=.+?['|"]/i",'',$content);//去除样式
  • $content = preg_replace("/lang=.+?['|"]/i",'',$content);//去除样式
  • $content = preg_replace("/width=.+?['|"]/i",'',$content);//去除样式
  • $content = preg_replace("/height=.+?['|"]/i",'',$content);//去除样式
  • $content = preg_replace("/border=.+?['|"]/i",'',$content);//去除样式
  • $content = preg_replace("/face=.+?['|"]/i",'',$content);//去除样式
  • $content = preg_replace("/face=.+?['|"]/",'',$content);
  • $content = preg_replace("/face=.+?['|"]/",'',$content);
  • $content=str_replace( " ","",$content);
  • return $content;
  • }
  • 复制代码

    >>> 您可能感兴趣的文章: 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标签自动补全的代码



    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template