编程语言
首页 > 编程语言> > php处理微信名称过滤emoji特殊符号

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));
    }

 

标签:trim,特殊符号,微信,preg,1F5FF,replace,php,nickname
来源: https://www.cnblogs.com/cy2268540857/p/15410255.html