Home >php教程 >php手册 >简单的过滤字符串中的HTML标记

简单的过滤字符串中的HTML标记

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:34:44939browse

function deleteHtml( $scr )
{
 $l = strlen( $scr );

 for( $i=0; $i {
  if( substr( $scr, $i, 1 ) == "  {
   // 当前位置
   $ii = $i;

   // 当$i大于字符长度时停止循环
   while( substr( $scr, $i, 1 ) != ">" && $i     $i++;

   // 当到大字符串最后时,重置$i到找到'   if ( $i == $l )
   {
    $i = $ii - 1;
    // 表示到达字符串结尾
    $b = 1;
   }

   $i++;
  }

  
  // 当下一个字符不是'  if (  substr( $scr, $i, 1 ) != '   $str = $str . substr( $scr, $i, 1 );
  else
   $i--;
 }

 return( $str );
}

Statement:
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