帝国cms自定义NOHTML函数标签过滤html代码用法

wdzsjl 1个月前 (10-29) 阅读数 23 #PbootCMS
  • 函数代码:
    function NoHTML($string) {     $string = preg_replace("'<script[^>]*?>.*?</script>'si", "", $string);     $string = preg_replace("'<[\/\!]*?[^<>]*?>'si", "", $string);     $string = preg_replace("'([\r\n])[\s]+'", "", $string);     $string = mb_ereg_replace('^( | )+', '', $string);     $string = mb_ereg_replace('( | )+$', '', $string);     $string = preg_replace("'&(quot|#34);'i", "", $string);     $string = preg_replace("'&(amp|#38);'i", "", $string);     $string = preg_replace("'&(lt|#60);'i", "", $string);     $string = preg_replace("'&(gt|#62);'i", "", $string);     $string = preg_replace("'&(nbsp|#160);'i", "", $string);     return $string; }
  • 调用方法:
    <?=NoHTML($navinfo['你的字段'])?>

     

wx.jpg ywfw.jpg
热门