我想把表情符号代码":)“转换成。
我如何转换它?
目前我正在使用p3k检测器来检测表情符号。下面是我可以检测表情符号的代码。
$emoji = \Emoji\detect_emoji($text);发布于 2018-08-23 00:16:33
我不能在这里插入整个函数,因为它绕过了堆栈溢出字符限制。下面是它的链接:
https://gist.github.com/BarryMode/432a7a1f9621e824c8a3a23084a50f60#file-htmlemoji-php
简而言之,该函数是
preg_replace_callback(pattern, callback, string);其中字符串是您想要更改为html实体的表情符号的输入。pattern使用正则表达式在字符串中查找表情符号,然后将每个表情符号提供给回调,这是从表情符号到html实体的转换发生的地方。
https://stackoverflow.com/questions/51970951
复制相似问题