解决方案;将表情转换成base64可以见格式,由于转换后长度过大,将其替换成对应字符保存入数据库
<?php class Emoji { /** * 将表情转成对应代表字符串 * @param string $content */ public static function emojiEncode($content = '') { if (!$content) { return $content; } $content = json_encode($content); $emoji = requrie_once('emoji.php'); $content = str_replace(array_keys($emoji['regenEncode']), $emoji['regenEncode'], $content); $content = json_decode($content, true); return $content; } /** * 将对应字符串转成表情 * @param string $content */ public static function emojiDecode($content = '') { if (!$content) { return $content; } $content = json_encode($content); $emoji = requrie_once('emoji.php'); $content = str_replace(array_keys($emoji['regenDecode']), $emoji['regenDecode'], $content); $content = json_decode($content, true); return $content; } }
以上就是php处理APP中 emoji表情包的方法的详细内容,更多请关注二当家的素材网其它相关文章!
友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群