过滤emoji表情的方法

    public static function replaceEmoji($str)
    {
        $str = preg_replace_callback(
            '/./u',
            function (array $match) {
                return strlen($match[0]) >= 4 ? '[表情]' : $match[0];
            },
            $str);

        return $str;
    }
原文地址:https://www.cnblogs.com/dongruiha/p/7941367.html