过滤微信昵称中的emoji

protected function emoji_filter($str) {

    if($str){
        $tmpStr = json_encode($str);
        //将emoji的unicode留下,其他不动
        $tmpStr= preg_replace("#(\\\ud[0-9a-f]{3})#i", "", $tmpStr);;
        $new_str = json_decode($tmpStr);
    }else{
        $new_str = '';
    }
    return $new_str;

}