author:咔咔php
wechat:fangkangfkjson
特殊詞彙資源下載地址:ui
https://download.csdn.net/download/fangkang7/10759073this
使用:
url
/** * [敏感字過濾] * @param $content 須要驗證的字符串 * @param $verify 是否提示驗證 * @return 替換後的內容 */ function lexVerify($content = '', $verify = false){ if(!$content) return false; $word = require './word.php'; // 引入敏感字詞庫 $lexicon = array_combine($word,array_fill(0,count($word),'*')); // 換字符 $str = strtr($content, $lexicon); // 匹配替換 return $str; } //獲取項目信息 public function insertInfo(){ //公司信息 $companyData = $this->request->param(); if($companyData != ''){ $data['user_id'] = $companyData['user_id']; $data['companyName'] = $this->lexVerify($companyData['companyName']); $data['companyType'] = $this->lexVerify($companyData['companyType']); $data['companyScale'] = $this->lexVerify($companyData['companyScale']); $product = Db::table('wxb_move_infometion')->insert($data); if($product){ $send = ['code'=>200,'msg'=>'公司信息添加成功']; }else{ $send = ['code'=>400,'msg'=>'公司信息添加失敗']; } $this->result($send,200,'數據初始化成功','json'); } }
效果.net