在iOS上通过PHP在推送通知中发送表情符号 [英] Sending Emoji in Push Notifications via PHP on iOS
问题描述
我想通过推送通知发送一些表情符号图标,但不知道我是怎么做的。
I'd like to send some emoji icons with push notifications, but have no idea how I do that.
有没有人用PHP成功实现了这个?我只是想以笑脸为前缀我的推送信息。
Has anyone successfully implemented this with PHP? I just want to prepend my push message with a smiley face for example.
我的问题纯粹是关于表情符号,我有一个成功的APNS脚本。
My question is purely about emoji, I have a successful APNS script.
感谢您提供任何指导。
推荐答案
使用快速的方法来执行此操作 html_entity_decode()
:
There's a quick 'n dirty way to do this using html_entity_decode()
:
示例:
$lightning = html_entity_decode('',ENT_NOQUOTES,'UTF-8');
//add this to the 'alert' portion of your APNS payload:
$message = "You just got the {$lightning}SHOCKER{$lightning}!";
基本上,您只需使用表情符号图标的十进制(非十六进制)代码创建一个HTML实体我想使用,并且 html_entity_decode()
会将其转换为您可以在字符串中使用的正确Unicode字符。前面提到的 http://code.iamcal.com/php/上有一个Unicode代码点目录。表情符号/ 网址。
Basically, you just create an HTML Entity with the decimal (not hex) code of the Emoji icon you'd like to use, and html_entity_decode()
will convert it to the correct Unicode character that you can use in a string. There's a catalog of Unicode code points at the previously-mentioned http://code.iamcal.com/php/emoji/ URL.
此方法适用于您无法在文本编辑器中输入的任何字符,表情符号或不符合表情符号。
This method should work for any character you can't type into your text editor, emoji or not.
这篇关于在iOS上通过PHP在推送通知中发送表情符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!