php-emoji使用详解

地址:https://github.com/iamcal/php-emoji

php-emoji - Process Emoji in PHP

This is a PHP library for dealing with Emoji, allowing you to convert between various native formats and displaying them using HTML.

You can read more about it and see a demo here: http://www.iamcal.com/emoji-in-web-apps/

The data this library is based on comes from another GitHub project: https://github.com/iamcal/emoji-data

USAGE

<?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));

When using the HTML format, you'll also need to include the emoji.css file, which points to the emoji.png image.

IMPORTANT NOTE: This library currently only deals with UTF-8. If your source data is JIS or Shift-JIS, you're out of luck for the moment.

Credits

By Cal Henderson cal@iamcal.com

Images and Emoji data come from emoji-data.

This work is dual-licensed under the GPL v3 and the MIT license.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值