php emoji处理微信表情
使用 https://github.com/iamcal/php-emoji 添加下面的函数到代码中
function utf8_bytes($cp){
if ($cp > 0x10000){
# 4 bytes
return chr(0xF0 | (($cp & 0x1C0000) >> 18)).
chr(0x80 | (($cp & 0x3F000) >> 12)).
chr(0x80 | (($cp & 0xFC0) >> 6)).
chr(0x80 | ($cp & 0x3F));
}else if ($cp > 0x800){
# 3 bytes
return chr(0xE0 | (($cp & 0xF000) >> 12)).
chr(0x80 | (($cp & 0xFC0) >> 6)).
chr(0x80 | ($cp & 0x3F));
}else if ($cp > 0x80){
# 2 bytes
return chr(0xC0 | (($cp & 0x7C0) >> 6)).
chr(0x80 | ($cp & 0x3F));
}else{
# 1 byte
return 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
php emoji处理微信表情的更多相关文章
- 【ionic】微信表情设置教程
NO.0 前提你的下载我的App :超级逗表情 Andorid:http://fir.im/chaojidbq Ios:https://github.com/apanly/chaojidbq (源码, ...
- 基于emoji 国际通用表情在web上的输入与显示的记录
定义: emoji 即国际通用表情 场景: 1,ios,android,wp上emoji表情输入与显示 2,web也需作为支撑平台对emoji表情就行输入与显示(解析) 问题: 1,app端输入的表情 ...
- 【java】【mysql】存储微信表情emoji表情
java.sql.SQLException: Incorrect string value: '\xF0\x9F\x92\x94' for colum n 'name' at row 1 at com ...
- 用微信表情翻译表白,程序员的小浪漫,赶紧Get起来!
- 搞搞电脑微信表情的破解(.dat转png or jpg)
首先感谢:https://blog.csdn.net/weixin_42440768/ 因为狗子喜欢之前那个头像,但是没找到,于是我想看看我们之前的斗图过程中有没有发她的头像. 这是做这件事情的起因. ...
- 微信表情js代码
var list = [], face_list = { "[微笑]": 1, "[撇嘴]": 2, "[色]": 3, "[发呆 ...
- 微信Emoji表情代码大全
参考网址 因PC端微信表情包不全,部分表情在PC中有显示问题,手机端微信不存在此问题,或者可以使用文字[微笑]这种方式添加微信表情 含义 标准 DoCoMo KDDI 软银 谷歌 微信 ✂复制这列
- WPF 微信 MVVM 【续】发送部分QQ表情
今天主要记录的就是发送QQ表情, WPF 微信 MVVM里写了,后期为了发送QQ表情,需要把TextBox替换为RichTextBox,接下来就说说替换的过程. 一.支持Binding的RichTex ...
- 微信公众平台开发(57)Emoji表情符号 【转发】
微信公众平台开发(57)Emoji表情符号 微信公众平台开发 微信公众平台开发模式 企业微信公众平台 Emoji表情符号 作者:方倍工作室 地址:http://www.cnblogs.com/tx ...
随机推荐
- 1不等于1?numeric、decimal、float 和 real 数据类型的区别
大家有没有在SQL中遇见1不等于1(1<>1)的情形!?下面会有一个例子演示这个情形. 先简单介绍一下标题中的四种数值数据类型. 在T-SQL中,numeric和decimal是精确数值数 ...
- UML Sequence sample: if-else
if (balance >= amount) { ... } else { ... }
- 移动web开发实践-css3(1)盒模型display:-webkit-box;的使用
提到移动布局不得不提到盒模型display:-webkit-box;这个属性,在移动布局中浮动已经不在重要,相反自适应成为主要的需求,所以display:-webkit-box;变得尤为重要. box ...
- NOIP2016参赛总结
NOIP2016复赛参赛总结 noip2016终于结束了,对于这次的比赛我只想说,死得好惨.(画风突变) 赛前趁着期中考浪到常州去培训,一天两套模拟的训练真的是心力交瘁(好吧没这么严重),不过那些模拟 ...
- 谈谈React Native环境安装中我遇到的坑
谈谈React Native环境安装 这个坑把我困了好久,真的是接近崩溃的边缘...整理出来分享给大家,希望遇到跟我一样问题的小伙伴能尽快找到答案. 首先,这是在初始化App之后,react-nati ...
- golang在linux下的开发环境部署[未完]
uname -a Linux symons_laptop 4.8.2-1-ARCH #1 SMP PREEMPT Mon Oct 17 08:11:46 CEST 2016 x86_64 GNU/Li ...
- redis集群同步迁移方法(一):通过redis replication实现
讲到redis的迁移,一般会使用rdb或者aof在主库做自动重载到目标库方法.但该方法有个问题就是无法保证源节点数据和目标节点数据保持一致,一般线上环境也不允许源库停机,所以要在迁移过程 ...
- Programming Entity Framework 翻译(1)-目录
1. Introducing the ADO.NET Entity Framework ado.net entity framework 介绍 1 The Entity Relationship Mo ...
- SQL Server 数据库的维护(三)__事务(transaction)和锁
--维护数据库-- --事务(transaction)和锁-- --事务(transaction)-- --概述: 事务是指封装了一组T-SQL语句的单个逻辑单元.单元中的所有语句作为一个整体,在满足 ...
- [Altera]PLL仿真
EDA Tools: 1.Quartus II 13.1(64-bit) 2.Modelsim SE-64 10.1c Time: 2016.05.05 ----------------------- ...