emoji

//接受emoji表情
function addEmoji($content){
        $return= preg_replace_callback('/[\xf0-\xf7].{3}/', function ($r){return '@E' . base64_encode($r[0]);}, $content);
        return $return;
}
//解析emoji表情
function getEmoji($content){
        $return=preg_replace_callback('/@E(.{6}==)/',function ($r){return base64_decode($r[1]);},$content);
        return $return;
}

你可能感兴趣的:(php)