当前位置:网站首页>PHP 代码 微信、公众号、企业微信 发送表情符号 [U+1F449]
PHP 代码 微信、公众号、企业微信 发送表情符号 [U+1F449]
2022-06-28 01:10:00 【fuchto】
添加调用方法
function utf8_bytes($cp) {
if ($cp > 0x10000){
return chr(0xF0 | (($cp & 0x1C0000) >> 18)).
chr(0x80 | (($cp & 0x3F000) >> 12)).
chr(0x80 | (($cp & 0xFC0) >> 6)).
chr(0x80 | ($cp & 0x3F));
}else if ($cp > 0x800){
return chr(0xE0 | (($cp & 0xF000) >> 12)).
chr(0x80 | (($cp & 0xFC0) >> 6)).
chr(0x80 | ($cp & 0x3F));
}else if ($cp > 0x80){
return chr(0xC0 | (($cp & 0x7C0) >> 6)).
chr(0x80 | ($cp & 0x3F));
}else{
return chr($cp);
}
}
转换表情
$content['conten'] 为发送的内容
$content['content'] = htmlspecialchars_decode($content['content']);
preg_match_all('/\[U\+(\\w{4,})\]/i', $content['content'], $matchArray);
if(!empty($matchArray[1])) {
foreach ($matchArray[1] as $emojiUSB) {
$content['content'] = str_ireplace("[U+{$emojiUSB}]", utf8_bytes(hexdec($emojiUSB)), $content['content']);
}
}边栏推荐
- 转载文章:数字经济催生强劲算力需求 英特尔发布多项创新技术挖掘算力潜能
- Interview: is bitmap pixel memory allocated in heap memory or native
- 如何开启多语言文本建议?Win11打开多语言文本建议的方法
- Win11无法使用动态壁纸怎么办?Win11用不了动态壁纸的解决方法
- Flashtext, a data cleaning tool, has directly increased the efficiency by dozens of times
- 无心剑汉英双语诗004.《剑》
- [today in history] June 1: Napster was founded; MS-DOS original author was born; Google sells Google SketchUp
- 【历史上的今天】6 月 5 日:洛夫莱斯和巴贝奇相遇;公钥密码学先驱诞生;函数语言设计先驱出生
- [cloud native] - docker installation and deployment of distributed database oceanbase
- [today in history] June 15: the first mobile phone virus; AI master simahe was born; Chromebook launch
猜你喜欢
随机推荐
STM32的C语言与汇编语言混合编程
Win11不能拖拽圖片到任務欄軟件上快速打開怎麼辦
Livedata interview question bank and answers -- 7 consecutive questions for livedata interview~
把腾讯搬上云:云服务器 CVM 的半部进化史
Mysql数据库基础:DML数据操作语言
Flutter 使用 CustomPaint 绘制基本图形
[today in history] June 11: the co inventor of Monte Carlo method was born; Google launched Google Earth; Google acquires waze
【历史上的今天】6 月 2 日:苹果推出了 Swift 编程语言;电信收购联通 C 网;OS X Yosemite 发布
PSM总结
Arduino Esp8266 Web LED控制
数仓的字符截取三胞胎:substrb、substr、substring
Win11如何关闭最近打开项目?Win11关闭最近打开项目的方法
JDBC与MySQL数据库
LiveData 面试题库、解答---LiveData 面试 7 连问~
"Dadao Zhichuang" won a ten million prea+ round of financing and launched a technology consumption robot
【历史上的今天】6 月 12 日:美国进入数字化电视时代;Mozilla 的最初开发者出生;3Com 和美国机器人公司合并
Raspberry pie - environment settings and cross compilation
【历史上的今天】5 月 29 日:共享软件先驱诞生;ChromeBox 推出;VoodooPC 创始人出生
Résumé de la graduation
新手炒股开户选哪家证券平台办理是最好最安全的








