扫码关注官方订阅号
function guolv($data){ $mgc=array("哈哈","哦"); for ($i=0; $i
写了个过滤敏感词的函数,不起作用,求教。
学习是最好的投资!
$mgc[i] >>> $mgc[$i]
这个情况可能这么写更加简单
$mgc=array("哈哈","哦"); str_replace($mgc, '*', $mgc);
function guolv($data){ $mgc=array("哈哈","哦"); for ($i=0; $i <count($mgc) ; $i++) { $data=str_replace($mgc[$i], “*”, $data);//原为$msg[i] } return $data; }
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
这个情况可能这么写更加简单