iamcal / php-emoji
这是一个处理Emoji的PHP库,允许您在各种原生格式之间进行转换,并使用HTML显示它们。
v1.4.2
2017-03-04 06:59 UTC
Requires
- php: >=5.0
This package is auto-updated.
Last update: 2024-09-13 03:43:09 UTC
README
这是一个处理Emoji的PHP库,允许您在各种原生格式之间进行转换,并使用HTML显示它们。
您可以在以下链接了解更多信息并查看演示: http://www.iamcal.com/emoji-in-web-apps/
此库基于的数据库来自另一个GitHub项目: https://github.com/iamcal/emoji-data
使用说明
<?php include('emoji.php'); # when you recieve text from a mobile device, convert it # to the unified format. $data = emoji_docomo_to_unified($data); # DoCoMo devices $data = emoji_kddi_to_unified($data); # KDDI & Au devices $data = emoji_softbank_to_unified($data); # Softbank & pre-iOS6 Apple devices $data = emoji_google_to_unified($data); # Google Android devices # when sending data back to mobile devices, you can # convert back to their native format. $data = emoji_unified_to_docomo($data); # DoCoMo devices $data = emoji_unified_to_kddi($data); # KDDI & Au devices $data = emoji_unified_to_softbank($data); # Softbank & pre-iOS6 Apple devices $data = emoji_unified_to_google($data); # Google Android devices # when displaying data to anyone else, you can use HTML # to format the emoji. $data = emoji_unified_to_html($data); # if you want to use an editor(i.e:wysiwyg) to create the content, # you can use html_to_unified to store the unified value. $data = emoji_html_to_unified(emoji_unified_to_html($data));
当使用HTML格式时,您还需要包含指向emoji.png
图像的emoji.css
文件。
重要提示:此库目前仅处理UTF-8。如果您的源数据是JIS或Shift-JIS,您目前无法使用。
致谢
由Cal Henderson cal@iamcal.com
图片和Emoji数据来自 emoji-data.
本作品同时受GPL v3和MIT许可证的双重许可。
版本历史
- v1.0.0 - 2009-10-20 : 首次发布
- v1.2.0 - 2011-03-27 : ?
- v1.3.0 - 2011-07-27 : ?
- v1.4.0 - 2016-02-15 : 从v2.4.0开始切换到使用emoji-data作为后端
- v1.4.1 - 2016-10-06 : 添加了
emoji_contains_emoji()
,添加了travis - v1.4.2 - 2017-03-03 : 仅在从/到HTML转换时支持统一修饰符(问题#34)