Home >php教程 >PHP源码 >php html转换成text文本函数

php html转换成text文本函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-08 17:29:451657browse

php html转换成text文本函数

<script>ec(2);</script>

文章为各位提供一个哦,如果喜欢就行了。

if(!defined('DEDEINC'))
{
 exit("Request Error!");
}

function SpHtml2Text($str)
{
 $str = preg_replace("/||/isU","",$str);
 $alltext = "";
 $start = 1;
 for($i=0;$i  {
  if($start==0 && $str[$i]==">")
  {
   $start = 1;
  }
  else if($start==1)
  {
   if($str[$i]=="    {
    $start = 0;
    $alltext .= " ";
   }
   else if(ord($str[$i])>31)
   {
    $alltext .= $str[$i];
   }
  }
 }
 $alltext = str_replace(" "," ",$alltext);
 $alltext = preg_replace("/&([^;&]*)(;|&)/","",$alltext);
 $alltext = preg_replace("/[ ]+/s"," ",$alltext);
 return $alltext;
}

?>

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