国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

inc_fun_funString.php 657B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. if (!defined('DEDEINC')) exit('dedebiz');
  3. function SpHtml2Text($str)
  4. {
  5. $str = preg_replace("/<sty(.*)\\/style>|<scr(.*)\\/script>|<!--(.*)-->/isU","",$str);
  6. $alltext = "";
  7. $start = 1;
  8. for($i=0;$i<strlen($str);$i++)
  9. {
  10. if($start==0 && $str[$i]==">")
  11. {
  12. $start = 1;
  13. }
  14. else if($start==1)
  15. {
  16. if($str[$i]=="<")
  17. {
  18. $start = 0;
  19. $alltext .= " ";
  20. }
  21. else if(ord($str[$i])>31)
  22. {
  23. $alltext .= $str[$i];
  24. }
  25. }
  26. }
  27. $alltext = str_replace(" "," ",$alltext);
  28. $alltext = preg_replace("/&([^;&]*)(;|&)/","",$alltext);
  29. $alltext = preg_replace("/[ ]+/s"," ",$alltext);
  30. return $alltext;
  31. }
  32. ?>