解决表情存储问题

// 解决表情emoji保存时出现乱码问题
// 输入的表情编译 $content为需要编译的内容
function emoji_json_encode($content)
{
$emoji=json_encode($content);
return preg_replace("#(\\\ue[0-9a-f]{3})#ie","addslashes('\\1')",$emoji);
}

//表情emoji反编译方法
function emoji_json_decode($content)
{
return json_decode($content);
}

 

posted @ 2018-07-04 09:33  wongjull  阅读(116)  评论(0编辑  收藏  举报