时间:2021-07-01 10:21:17 帮助过:23人阅读
解决方案;将表情转换成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表情包的方法的详细内容,更多请关注Gxl网其它相关文章!