帝国cms过滤特定的字符函数,多用于简介地方,把函数放在“/e/class/connect.php”最后面,当然你只对前台过滤也可以放在“/e/class/userfun.php”里面,我由于要对整个系统二次开发所以放在connect后面,前后台都可以使用。

//去除HTML标记function NoHTML($string){  $string = preg_replace("'<script[^>]*?>.*?</script>'si", "", $string);//去掉javascript  $string = preg_replace("'<[\/\!]*?[^<>]*?>'si", "", $string);         //去掉HTML标记  $string = preg_replace("'([\r\n])[\s]+'", "", $string);               //去掉空白字符  $string = mb_ereg_replace('^( | )+', '', $string);  $string = mb_ereg_replace('( | )+$', '', $string);  $string = preg_replace("'&(quot|#34);'i", "", $string);               //替换HTML实体  $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['你的字段'])?>