当前位置:网站首页>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']);
}
}边栏推荐
- 树莓派-环境设置和交叉编译
- > Could not create task ‘:app:MyTest. main()‘. > SourceSet with name ‘main‘ not found. Problem repair
- 字节跳动面试官:一张图片占据的内存大小是如何计算
- 【历史上的今天】5 月 29 日:共享软件先驱诞生;ChromeBox 推出;VoodooPC 创始人出生
- Arduino Esp8266 Web LED控制
- How to enable multi language text suggestions? Win11 method to open multilingual text suggestions
- STM32的C语言与汇编语言混合编程
- [today in history] June 8: the father of the world wide web was born; PHP public release; IPhone 4 comes out
- 【历史上的今天】6 月 25 日:笔记本之父诞生;Windows 98 发布;通用产品代码首次商用
- [today in history] June 25: the father of notebook was born; Windows 98 release; First commercial use of generic product code
猜你喜欢

How to systematically learn LabVIEW?

Review the submission of small papers for 2022 spring semester courses
![[today in history] June 24: Netease was established; The first consumer electronics exhibition was held; The first webcast in the world](/img/f7/b3239802d19d00f760bb3174649a89.jpg)
[today in history] June 24: Netease was established; The first consumer electronics exhibition was held; The first webcast in the world

【云原生】-Docker安装部署分布式数据库 OceanBase

How does win11 add printers and scanners? Win11 add printer and scanner settings

win11如何添加打印机和扫描仪?win11添加打印机和扫描仪的设置

为什么大厂压力大,竞争大,还有这么多人热衷于大厂呢?

Flask基础:模板渲染+模板过滤使用+控制语句

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

Writing C program with GCC and makefile for the first time
随机推荐
【历史上的今天】6 月 25 日:笔记本之父诞生;Windows 98 发布;通用产品代码首次商用
> Could not create task ‘:app:MyTest.main()‘. > SourceSet with name ‘main‘ not found.问题修复
Online JSON to plaintext tool
Mysql database foundation: DML data operation language
How to judge that the thread pool has completed all tasks?
[2D code image correction and enhancement] simulation of 2D code image correction and enhancement processing based on MATLAB
第三批入围企业公示!年度TOP100智能网联供应商评选
畢業總結
Flask Foundation: template inheritance + static file configuration
【历史上的今天】6 月 17 日:术语“超文本”的创造者出生;Novell 首席科学家诞生;探索频道开播
Step by step interpretation of crf+bilstm code
Basic flask: template rendering + template filtering + control statement
STM32F1与STM32CubeIDE编程实例-金属触摸传感器驱动
[today in history] June 11: the co inventor of Monte Carlo method was born; Google launched Google Earth; Google acquires waze
数仓的字符截取三胞胎:substrb、substr、substring
英特尔锐炫A380显卡即将在中国面市
Online text batch inversion by line tool
Win11无法使用动态壁纸怎么办?Win11用不了动态壁纸的解决方法
Usage details of staticlayout
【历史上的今天】6 月 24 日:网易成立;首届消费电子展召开;世界上第一次网络直播