php处理微信名称过滤emoji特殊符号

2021/10/15 11:44:26

本文主要是介绍php处理微信名称过滤emoji特殊符号,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

    public function filterNickname($nickname){
        $nickname = preg_replace('/[\x{1F600}-\x{1F64F}]/u', '', $nickname);

        $nickname = preg_replace('/[\x{1F300}-\x{1F5FF}]/u', '', $nickname);

        $nickname = preg_replace('/[\x{1F680}-\x{1F6FF}]/u', '', $nickname);

        $nickname = preg_replace('/[\x{2600}-\x{26FF}]/u', '', $nickname);

        $nickname = preg_replace('/[\x{2700}-\x{27BF}]/u', '', $nickname);
        $nickname = preg_replace('/[\xf0-\xf7].{3}/', '', $nickname);

        $nickname = str_replace(array('"','\''), '', $nickname);

        return addslashes(trim($nickname));
    }

 



这篇关于php处理微信名称过滤emoji特殊符号的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程