当前位置:首页 > 微信 > 正文

移除微信昵称中的emoji字符

11-25 微信

标签:graphs   ret   截取   map   bsp   bat   nbsp   symbol   ram   

移除微信昵称中的emoji字符:
/**
 * 移除微信昵称中的emoji字符
 * @param type $nickname
 * @return type
 */
function removeEmoji($nickname) {
    $clean_text = "";
    // Match Emoticons
    $regexEmoticons = ‘/[x{1F600}-x{1F64F}]/u‘;
    $clean_text = preg_replace($regexEmoticons, ‘‘, $nickname);
    // Match Miscellaneous Symbols and Pictographs
    $regexSymbols = ‘/[x{1F300}-x{1F5FF}]/u‘;
    $clean_text = preg_replace($regexSymbols, ‘‘, $clean_text);
    // Match Transport And Map Symbols
    $regexTransport = ‘/[x{1F680}-x{1F6FF}]/u‘;
    $clean_text = preg_replace($regexTransport, ‘‘, $clean_text);
    // Match Miscellaneous Symbols
    $regexMisc = ‘/[x{2600}-x{26FF}]/u‘;
    $clean_text = preg_replace($regexMisc, ‘‘, $clean_text);
    // Match Dingbats
    $regexDingbats = ‘/[x{2700}-x{27BF}]/u‘;
    $clean_text = preg_replace($regexDingbats, ‘‘, $clean_text);
    //截取指定长度的昵称
    $clean_text = ds_substing($clean_text,0,20);
    return trim($clean_text);
}

 

移除微信昵称中的emoji字符

标签:graphs   ret   截取   map   bsp   bat   nbsp   symbol   ram   

温馨提示: 本文由杰米博客推荐,转载请保留链接: https://www.jmwww.net/weixin/15511.html

博客主人杰米WWW
杰米博客,为大家提供seo以及it方面技巧喜欢的朋友收藏哦!
  • 11365文章总数
  • 2266821访问次数
  • 建站天数
  • 头条文章

    图文推荐

    站长推荐

    友情链接