添加过滤昵称字符

This commit is contained in:
sugar1569 2019-02-14 10:34:11 +08:00
parent d6b2722764
commit ef1089196c

View File

@ -58,3 +58,15 @@ function makePathToUrl($path,$type = 2)
}else return '';
}
// 过滤掉emoji表情
function filterEmoji($str)
{
$str = preg_replace_callback( //执行一个正则表达式搜索并且使用一个回调进行替换
'/./u',
function (array $match) {
return strlen($match[0]) >= 4 ? '' : $match[0];
},
$str);
return $str;
}