From ef1089196ca85aebe15cc2ca982d7aa0016ca4ed Mon Sep 17 00:00:00 2001 From: sugar1569 Date: Thu, 14 Feb 2019 10:34:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=BF=87=E6=BB=A4=E6=98=B5?= =?UTF-8?q?=E7=A7=B0=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/application/common.php b/application/common.php index 519a6707..08eae7aa 100644 --- a/application/common.php +++ b/application/common.php @@ -57,4 +57,16 @@ function makePathToUrl($path,$type = 2) return trim(str_replace(DS, '/',UPLOAD_PATH.$path),'.'); }else return ''; +} +// 过滤掉emoji表情 +function filterEmoji($str) +{ + $str = preg_replace_callback( //执行一个正则表达式搜索并且使用一个回调进行替换 + '/./u', + function (array $match) { + return strlen($match[0]) >= 4 ? '' : $match[0]; + }, + $str); + + return $str; } \ No newline at end of file