"敏感词管理"中添加敏感词,然后修改phpcms\modules\content\content.php文件来实现添加或者编辑内容时敏感词的替换。在add方法和edit方法中。">
赞
踩
后台先在"扩展"——>"敏感词管理"中添加敏感词,然后修改phpcms\modules\content\content.php文件来实现添加或者编辑内容时敏感词的替换。(如果涉及会员投稿和留言等,也需要在对应模块中做类似处理)
在add方法和edit方法中if(trim($_POST['info']['title'])=='') showmessage(L('title_is_empty'));下方添加如下代码:
- //敏感词替换操作开始
- $this->badword_model = pc_base::load_model('badword_model');
- $badword_array=$this->badword_model->select();
- if(!empty($badword_array)){
- foreach($badword_array as $key_index=>$badword_one){
- $_POST['info']['title']=str_replace($badword_one['badword'],$badword_one['replaceword'],$_POST['info']['title']);
- $_POST['info']['content']=str_replace($badword_one['badword'],$badword_one['replaceword'],$_POST['info']['content']);
- }
- }
- //敏感词替换结束
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。