使用 https://github.com/iamcal/php-emoji 添加下面的函数到代码中

    function utf8_bytes($cp){if ($cp > 0x10000){# 4 bytesreturn    chr(0xF0 | (($cp & 0x1C0000) >> 18)).chr(0x80 | (($cp & 0x3F000) >> 12)).chr(0x80 | (($cp & 0xFC0) >> 6)).chr(0x80 | ($cp & 0x3F));}else if ($cp > 0x800){# 3 bytesreturn    chr(0xE0 | (($cp & 0xF000) >> 12)).chr(0x80 | (($cp & 0xFC0) >> 6)).chr(0x80 | ($cp & 0x3F));}else if ($cp > 0x80){# 2 bytesreturn    chr(0xC0 | (($cp & 0x7C0) >> 6)).chr(0x80 | ($cp & 0x3F));}else{# 1 bytereturn chr($cp);}}function parseHtmlemoji ($text){$tmpStr = json_encode($text);$tmpStr = preg_replace("#(\\\ue[0-9a-f]{3})#ie", "addslashes('\\1')", $tmpStr);$text = json_decode($tmpStr);preg_match_all("#u([0-9a-f]{4})+#iUs", $text, $rs);if (empty($rs[1])) {return $text;}foreach ($rs[1] as $v) {$test_iphone = '0x' . trim(strtoupper($v));$test_iphone = $test_iphone + 0;$t = emoji_unified_to_html(emoji_softbank_to_unified(utf8_bytes($test_iphone)));$text = str_replace("\u$v", $t, $text);}return $text;}

微信qq的表情

return [
'/::)'=>'<img class="wechat-emoji" src="/styles/wechat/100.gif" alt="微笑" width="24">',
'/::~'=>'<img  class="wechat-emoji" src="/styles/wechat/101.gif" alt="伤心">',
'/::B'=>'<img  class="wechat-emoji" src="/styles/wechat/102.gif" alt="美女">',
'/::|'=>'<img  class="wechat-emoji" src="/styles/wechat/103.gif" alt="发呆">',
'/:8-)'=>'<img  class="wechat-emoji" src="/styles/wechat/104.gif" alt="墨镜">',
'/::<'=>'<img  class="wechat-emoji" src="/styles/wechat/105.gif" alt="哭">',
'/::$'=>'<img  class="wechat-emoji" src="/styles/wechat/106.gif" alt="羞">',
'/::X'=>'<img  class="wechat-emoji" src="/styles/wechat/107.gif" alt="哑">',
'/::Z'=>'<img  class="wechat-emoji" src="/styles/wechat/108.gif" alt="睡">',
'/::\'('=>'<img  class="wechat-emoji" src="/styles/wechat/109.gif" alt="哭">','/::-|'=>'<img  class="wechat-emoji" src="/styles/wechat/110.gif" alt="囧">',
'/::@'=>'<img  class="wechat-emoji" src="/styles/wechat/111.gif" alt="怒">',
'/::P'=>'<img  class="wechat-emoji" src="/styles/wechat/112.gif" alt="调皮">',
'/::D'=>'<img  class="wechat-emoji" src="/styles/wechat/113.gif" alt="笑">',
'/::O'=>'<img  class="wechat-emoji" src="/styles/wechat/114.gif" alt="惊讶">',
'/::('=>'<img  class="wechat-emoji" src="/styles/wechat/115.gif" alt="难过">',
'/::+'=>'<img  class="wechat-emoji" src="/styles/wechat/116.gif" alt="酷">',
'/:--b'=>'<img  class="wechat-emoji" src="/styles/wechat/117.gif" alt="汗">',
'/::Q'=>'<img  class="wechat-emoji" src="/styles/wechat/118.gif" alt="抓狂">',
'/::T'=>'<img  class="wechat-emoji" src="/styles/wechat/119.gif" alt="吐">','/:,@P'=>'<img  class="wechat-emoji" src="/styles/wechat/120.gif" alt="笑">',
'/:,@-D'=>'<img  class="wechat-emoji"  src="/styles/wechat/121.gif" alt="快乐">',
'/::d'=>'<img  class="wechat-emoji" src="/styles/wechat/122.gif" alt="奇">',
'/:,@o'=>'<img  class="wechat-emoji" src="/styles/wechat/123.gif" alt="傲">',
'/::g'=>'<img  class="wechat-emoji" src="/styles/wechat/124.gif" alt="饿">',
'/:|-)'=>'<img  class="wechat-emoji" src="/styles/wechat/125.gif" alt="累">',
'/::!'=>'<img  class="wechat-emoji" src="/styles/wechat/126.gif" alt="吓">',
'/::L'=>'<img  class="wechat-emoji" src="/styles/wechat/127.gif" alt="汗">',
'/::>'=>'<img  class="wechat-emoji" src="/styles/wechat/128.gif" alt="高兴">',
'/::,@'=>'<img  class="wechat-emoji" src="/styles/wechat/129.gif" alt="闲">','/:,@f'=>'<img  class="wechat-emoji" src="/styles/wechat/130.gif" alt="努力">',
'/::-S'=>'<img  class="wechat-emoji" src="/styles/wechat/131.gif" alt="骂">',
'/:?'=>'<img  class="wechat-emoji" src="/styles/wechat/132.gif" alt="疑问">',
'/:,@x'=>'<img  class="wechat-emoji" src="/styles/wechat/133.gif" alt="秘密">',
'/:,@@'=>'<img  class="wechat-emoji" src="/styles/wechat/134.gif" alt="乱">',
'/::8'=>'<img  class="wechat-emoji" src="/styles/wechat/135.gif" alt="疯">',
'/:,@!'=>'<img  class="wechat-emoji" src="/styles/wechat/136.gif" alt="哀">',
'/:!!!'=>'<img  class="wechat-emoji" src="/styles/wechat/137.gif" alt="鬼">',
'/:xx'=>'<img  class="wechat-emoji" src="/styles/wechat/138.gif" alt="打击">',
'/:bye'=>'<img  class="wechat-emoji" src="/styles/wechat/139.gif" alt="bye">','/:wipe'=>'<img  class="wechat-emoji" src="/styles/wechat/140.gif" alt="汗">',
'/:dig'=>'<img  class="wechat-emoji" src="/styles/wechat/141.gif" alt="抠">',
'/:handclap'=>'<img  class="wechat-emoji" src="/styles/wechat/142.gif" alt="鼓掌">',
'/:&-('=>'<img  class="wechat-emoji" src="/styles/wechat/143.gif" alt="糟糕">',
'/:B-)'=>'<img  class="wechat-emoji" src="/styles/wechat/144.gif" alt="恶搞">',
'/:<@'=>'<img  class="wechat-emoji" src="/styles/wechat/145.gif" alt="什么">',
'/:@>'=>'<img  class="wechat-emoji" src="/styles/wechat/146.gif" alt="什么">',
'/::-O'=>'<img  class="wechat-emoji" src="/styles/wechat/147.gif" alt="累">',
'/:>-|'=>'<img  class="wechat-emoji" src="/styles/wechat/148.gif" alt="看">',
'/:P-('=>'<img  class="wechat-emoji" src="/styles/wechat/149.gif" alt="难过">','/::\'|'=>'<img  class="wechat-emoji" src="/styles/wechat/150.gif" alt="难过">',
'/:X-)'=>'<img  class="wechat-emoji" src="/styles/wechat/151.gif" alt="坏">',
'/::*'=>'<img  class="wechat-emoji" src="/styles/wechat/152.gif" alt="亲">',
'/:@x'=>'<img  class="wechat-emoji" src="/styles/wechat/153.gif" alt="吓">',
'/:8*'=>'<img  class="wechat-emoji" src="/styles/wechat/154.gif" alt="可怜">',
'/:pd'=>'<img  class="wechat-emoji" src="/styles/wechat/155.gif" alt="刀">',
'/:<W>'=>'<img  class="wechat-emoji" src="/styles/wechat/156.gif" alt="水果">',
'/:beer'=>'<img  class="wechat-emoji" src="/styles/wechat/157.gif" alt="酒">',
'/:basketb'=>'<img  class="wechat-emoji" src="/styles/wechat/158.gif" alt="篮球">',
'/:oo'=>'<img  class="wechat-emoji" src="/styles/wechat/159.gif" alt="乒乓">','/:coffee'=>'<img  class="wechat-emoji" src="/styles/wechat/160.gif" alt="咖啡">',
'/:eat'=>'<img  class="wechat-emoji" src="/styles/wechat/161.gif" alt="美食">',
'/:pig'=>'<img  class="wechat-emoji" src="/styles/wechat/162.gif" alt="动物">',
'/:rose'=>'<img  class="wechat-emoji" src="/styles/wechat/163.gif" alt="鲜花">',
'/:fade'=>'<img  class="wechat-emoji" src="/styles/wechat/164.gif" alt="枯">',
'/:showlove'=>'<img  class="wechat-emoji" src="/styles/wechat/165.gif" alt="唇">',
'/:heart'=>'<img  class="wechat-emoji" src="/styles/wechat/166.gif" alt="爱">',
'/:break'=>'<img  class="wechat-emoji" src="/styles/wechat/167.gif" alt="分手">',
'/:cake'=>'<img  class="wechat-emoji" src="/styles/wechat/168.gif" alt="生日">',
'/:li'=>'<img  class="wechat-emoji"  src="/styles/wechat/169.gif" alt="电">','/:bome'=>'<img class="wechat-emoji"  src="/styles/wechat/170.gif" alt="炸弹">',
'/:kn'=>'<img  class="wechat-emoji" src="/styles/wechat/171.gif" alt="刀子">',
'/:footb'=>'<img  class="wechat-emoji" src="/styles/wechat/172.gif" alt="足球">',
'/:ladybug'=>'<img  class="wechat-emoji" src="/styles/wechat/173.gif" alt="瓢虫">',
'/:shit'=>'<img  class="wechat-emoji" src="/styles/wechat/174.gif" alt="翔">',
'/:moon'=>'<img  class="wechat-emoji" src="/styles/wechat/175.gif" alt="月亮">',
'/:sun'=>'<img  class="wechat-emoji" src="/styles/wechat/176.gif" alt="太阳">',
'/:gift'=>'<img  class="wechat-emoji" src="/styles/wechat/177.gif" alt="礼物">',
'/:hug'=>'<img  class="wechat-emoji" src="/styles/wechat/178.gif" alt="抱抱">',
'/:strong'=>'<img class="wechat-emoji"  src="/styles/wechat/179.gif" alt="拇指">','/:weak'=>'<img class="wechat-emoji"  src="/styles/wechat/180.gif" alt="贬低">',
'/:share'=>'<img  class="wechat-emoji" src="/styles/wechat/181.gif" alt="握手">',
'/:v'=>'<img  class="wechat-emoji" src="/styles/wechat/182.gif" alt="剪刀手">',
'/:@)'=>'<img class="wechat-emoji"  src="/styles/wechat/183.gif" alt="抱拳">',
'/:jj'=>'<img  class="wechat-emoji" src="/styles/wechat/184.gif" alt="勾引">',
'/:@@'=>'<img  class="wechat-emoji" src="/styles/wechat/185.gif" alt="拳头">',
'/:bad'=>'<img class="wechat-emoji"  src="/styles/wechat/186.gif" alt="小拇指">',
'/:lvu'=>'<img class="wechat-emoji"  src="/styles/wechat/187.gif" alt="拇指八">',
'/:no'=>'<img  class="wechat-emoji" src="/styles/wechat/188.gif" alt="食指">',
'/:ok'=>'<img  class="wechat-emoji" src="/styles/wechat/189.gif" alt="ok">','/:love'=>'<img  class="wechat-emoji" src="/styles/wechat/190.gif" alt="情侣">',
'/:<L>'=>'<img  class="wechat-emoji" src="/styles/wechat/191.gif" alt="爱心">',
'/:jump'=>'<img  class="wechat-emoji" src="/styles/wechat/192.gif" alt="蹦哒">',
'/:shake'=>'<img  class="wechat-emoji" src="/styles/wechat/193.gif" alt="颤抖">',
'/:<O>'=>'<img class="wechat-emoji"  src="/styles/wechat/194.gif" alt="怄气">',
'/:circle'=>'<img  class="wechat-emoji" src="/styles/wechat/195.gif" alt="跳舞">',
'/:kotow'=>'<img  class="wechat-emoji" src="/styles/wechat/196.gif" alt="发呆">',
'/:turn'=>'<img class="wechat-emoji"  src="/styles/wechat/197.gif" alt="背着">',
'/:skip'=>'<img class="wechat-emoji"  src="/styles/wechat/198.gif" alt="伸手">',
'/:oY'=>'<img class="wechat-emoji"  src="/styles/wechat/199.gif" alt="耍帅">',];

使用代码进行替换即可,表情文件包http://files.cnblogs.com/files/benlightning/wechatface.zip

转载于:https://www.cnblogs.com/benlightning/p/5144891.html

php emoji处理微信表情相关推荐

  1. mysql保存Emoji表情或微信文字、图文回复带Emoji等微信表情图标?

    背景: 客户需要在自动回复的文字.图文表情上使用Emoji表情? 原因: Mysql表设计时,都是用UTF8字符集的,Mysql的utf8字符集是3字节的,而emoji是4字节,所以保存修改等操作会出 ...

  2. 关于微信表情及输入法emoji显示问题解决方案

    1.保存数据库报错,数据库字符集修改为mb4,这个网上很多文章说过了 2.微信表情内容为:[微笑]  /::)  中文和英文两种 这个用字符串替换为图片,代码地址:https://github.com ...

  3. mysql emoy表情_GitHub - PandaQAQ/PandaEmoView: emoji gif 表情图文混排,仿微信表情输入...

    该库具有以下特点: 支持 emoji 表情图片 支持 gif 动态表情输入显示 支持单张贴图表情(与微信收藏表情一致) 支持题图表情库的添加删除 效果图: 快速使用 引入库 compile 'com. ...

  4. mysql 过滤emoji表情_过滤微信表情/emoji表情

    微信表情/emoji表情是个麻烦的东西,即使你能存储,也不一定能完美显示.在iOS以外的平台上,例如PC或者android.如果你需要显示emoji,就得准备一大堆emoji图片并使用第三方前端类库才 ...

  5. js实现微信表情发送

    前景:之前有个项目是做的多个公众号管理平台,由于客户那边有多个公众号,用微信开放平台去管理太繁琐,数据也不能进行统一分析,在开发过程中,需要将微信开放平台功能--消息回复移接本系统,消息回复时涉及到表 ...

  6. js实现微信表情回显

    上文介绍了微信表情的发送,这篇文章介绍下微信表情回显时的方法,相对于表情发送的功能,回显这块显得简单多了 我们还是用原有的数组来处理,后端返回的格式例如:哈哈[左哼哼]  这样类型,我们只需将[左哼哼 ...

  7. 微信表情的字符编号完整版【图文并茂哦!】

    [图文并茂哦!] Emoji表情的分类(微信表情的字符编号完整版) Emoji表情有很多种版本,包括Unified.FreeEIM.DoCoMo.KDDI.Softbank和Google,而且不同版本 ...

  8. 微信表情过滤 EmojiFilterUtil

    import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.regex.PatternSyntax ...

  9. 仿微信表情输入键盘(支持 Gif 表情图文混排 )

    作者 | PandaQ404 地址 | http://www.jianshu.com/p/fddca2b0a26b 声明 | 本文是 PandaQ404 原创,已获授权发布,未经原作者允许请勿转载 简 ...

  10. php 微信表情 转码和解码方法

    php 微信表情存数据转义方法 表情转码 表情解码 表情转码 /** 转义emoji*/ function userTextEncode($str){if(! is_string($str)) ret ...

最新文章

  1. Spring MVC配置
  2. xutils使用手册(二)——数据库
  3. 每日一皮:项目开发停在了最后10%的效果...
  4. layui给select下拉框赋值
  5. SDN精华问答 | SDN可以做什么?
  6. Flutter PageView 使用详细概述
  7. 谷歌 analytics.js 简要分析
  8. e5cc温控仪通讯参数设定_应用 | 如何实现S7300与S7200smart通讯?
  9. 2022年湖北大学招生简章--成人高等教育高起专、专升本学历提升
  10. unity使用Curvy随机选择路线
  11. 男生的长相到底有多重要?
  12. 苹果应用商店AppStore审核规则指南
  13. mysql 闰年,[MySQL]--gt;查询5天之内过生日的同事中的闰年2月
  14. C#针式打印机自定义纸张连续打印爬坑过程
  15. 如何用ABBYY FineReader提取图片中的文字
  16. html中ul怎么写,HTML: ul 标签
  17. 如何避免自己写的代码成为别人眼中的一坨屎 (摘自微信公众号,顶级程序员)...
  18. 以下使用计算机的不良习惯,1.以下使用计算机的不好习惯是( )。 A. 关机前退出所有正在执行的应用程序 B. 使用标准的文件扩展名 C....
  19. 家庭用电都是交流电,为何会有零线和火线的区别?
  20. 基于opencv的身份证识别(KNN与OCR两种算法)

热门文章

  1. javascript操作cookie实例
  2. 天池NLP赛道top指南
  3. 【EMNLP2020】融合自训练和自监督方法的无监督文本顺滑研究
  4. 【Python】106页的《python进阶》,附下载
  5. 强烈推荐 | 算法/深度学习/NLP面试笔记
  6. 搞懂 Vision Transformer 原理和代码,看这篇技术综述就够了(五)
  7. mysql基础8-运算符、函数、索引
  8. 从零实现深度学习框架——N-Gram语言模型(一)
  9. 超人气新书《SEO实战密码——60天网站流量提高20倍》火爆热销
  10. 博文视点大讲堂第24期:PPT演示之道