PHP使用preg_replace和preg_match过滤敏感词
代码1:
<?PHP
$badstring="tmd|妈的|TNND|她娘的";
$string="你tmd说什么,她娘的,不是人";
echo preg_replace("/$badstring/i",'',$string);
?>
$badstring="tmd|妈的|TNND|她娘的";
$string="你tmd说什么,她娘的,不是人";
echo preg_replace("/$badstring/i",'',$string);
?>
代码2: