当前位置:网站首页>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']);
}
}边栏推荐
- 横向滚动的RecycleView一屏显示五个半,低于五个平均分布
- [2D code image correction and enhancement] simulation of 2D code image correction and enhancement processing based on MATLAB
- 毕业季来临,2022届高校毕业生人数首次突破千万大关
- [today in history] June 19: iPhone 3GS launched; Pascal was born; Anti terrorist elite begins testing
- Opencv -- Hough transform and some problems encountered
- 【历史上的今天】6 月 16 日:甲骨文成立;微软 MSX 诞生;快速傅里叶变换发明者出生
- 【历史上的今天】6 月 1 日:Napster 成立;MS-DOS 原作者出生;谷歌出售 Google SketchUp
- [today in history] May 31: the father of Amiga was born; The co developer of basic language was born; BlackBerry BBM shutdown
- 如何判断线程池已经执行完所有任务了?
- [today in history] June 1: Napster was founded; MS-DOS original author was born; Google sells Google SketchUp
猜你喜欢

> Could not create task ‘:app:MyTest.main()‘. > SourceSet with name ‘main‘ not found.问题修复

Design e-commerce seckill system

【历史上的今天】6 月 17 日:术语“超文本”的创造者出生;Novell 首席科学家诞生;探索频道开播

【历史上的今天】6 月 12 日:美国进入数字化电视时代;Mozilla 的最初开发者出生;3Com 和美国机器人公司合并

【模糊神经网络】基于matlab的模糊神经网络仿真

基于STM32的编写

【二维码图像矫正增强】基于MATLAB的二维码图像矫正增强处理仿真

【历史上的今天】6 月 11 日:蒙特卡罗方法的共同发明者出生;谷歌推出 Google 地球;谷歌收购 Waze

【历史上的今天】6 月 2 日:苹果推出了 Swift 编程语言;电信收购联通 C 网;OS X Yosemite 发布

Initial linear regression
随机推荐
JDBC and MySQL databases
【历史上的今天】6 月 15 日:第一个手机病毒;AI 巨匠司马贺诞生;Chromebook 发布
Publicity of the third batch of shortlisted enterprises! Annual Top100 smart network supplier selection
Différences d'utilisation entre IsEmpty et isblank
2021年软件测试工具总结——模糊测试工具
初始线性回归
Step by step interpretation of crf+bilstm code
【历史上的今天】6 月 12 日:美国进入数字化电视时代;Mozilla 的最初开发者出生;3Com 和美国机器人公司合并
【历史上的今天】6 月 2 日:苹果推出了 Swift 编程语言;电信收购联通 C 网;OS X Yosemite 发布
[today in history] June 5: Lovelace and Babbage met; The pioneer of public key cryptography was born; Functional language design pioneer born
CRF+BiLSTM代码分步骤解读
How to run unity webgl after packaging (Firefox configuration)
Interview: how do lists duplicate objects according to their attributes?
【历史上的今天】6 月 10 日:Apple II 问世;微软收购 GECAD;发明“软件工程”一词的科技先驱出生
Writing based on stm32
Opencv -- Hough transform and some problems encountered
如何判断线程池已经执行完所有任务了?
isEmpty 和 isBlank 的用法区别
Online JSON to plaintext tool
Interpretation of bilstm-crf in NER forward_ algorithm