PHP将emoji表情进行过滤

// 过滤掉emoji表情
function filterEmoji($str) {
    $str = preg_replace_callback(
        '/./u',
        function (array $match) {
            return strlen($match[0]) >= 4 ? '' : $match[0];
        },
    $str);
    return $str;
}

 

posted @ 2021-09-02 11:31  Duye-bk  阅读(307)  评论(0编辑  收藏  举报