php去除emoji表情代码

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wm9028/article/details/88641905

找了好久,亲测可用的代码

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

     return $str;
 }

猜你喜欢

转载自blog.csdn.net/wm9028/article/details/88641905
今日推荐