需要的材料:

  php-emoji类库的下载地址:https://github.com/iamcal/php-emoji

代码示例:(该代码来自官网)

 <?php
include('emoji.php'); # when you recieve text from a mobile device, convert it
# to the unified format.
//当你从移动设备里接收到信息,要将这些信息转为统一格式
//以下4个函数是从其他设备的格式转为统一格式 $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.
//以下4个函数是从统一格式转为其他设备能使用的格式 $data = emoji_unified_docomo($data); # DoCoMo devices
$data = emoji_unified_kddi($data); # KDDI & Au devices
$data = emoji_unified_softbank($data); # Softbank & pre-iOS6 Apple devices
$data = emoji_unified_google($data); # Google Android devices # when displaying data to anyone else, you can use HTML
# to format the emoji.
//从统一格式转为html格式 $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));

实现网页显示emoji表情的步骤:

  一、下载php-emoji

  二、在html文件里导入emoji.css文件

  三、在脚本里导入emoji.php文件

  完整代码:

 <!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<!-- 导入emoji.css文件,切记一定要导入 -->
<link rel="stylesheet" type="text/css" href="./php_emoji/emoji.css">
</head>
<body>
<div id="chatContent">
<?php
//导入php_emoji类
include('./php_emoji/emoji.php');
//$data是emoji表情的数据
$data = emoji_unified_to_html($data);
//此时就能echo出emoji表情
echo $data;
?>
</div>
</body>
</html>

备注:一定要导入emoji.css文件

使用php-emoji类让网页显示emoji表情的更多相关文章

  1. [修正] Firemonkey Android 显示 Emoji (颜文字)

    问题:在 Android 平台下,显示 Emoji 文字,无法显示彩色(皆为黑色),例如 Edit 控件,即使将 Edit.ControlType = Platform 设为平台原生控件,还是没用(真 ...

  2. 修复Arch Linux和Manjaro Linux无法显示emoji的问题

    安装好Arch Linux或Manjaro Linux系统后默认没办法正常显示emoji,通常会变成方框或者带有unicode码的方块: 这是因为缺失字体以及相关的字体配置导致的. 当然也有一小部分应 ...

  3. php 缓存工具类 实现网页缓存

    php 缓存工具类 实现网页缓存 php程序在抵抗大流量访问的时候动态网站往往都是难以招架,所以要引入缓存机制,一般情况下有两种类型缓存 一.文件缓存 二.数据查询结果缓存,使用内存来实现高速缓存 本 ...

  4. IOS 公共类-MyMBProgressUtil Progress显示

    IOS 公共类-MyMBProgressUtil Progress显示 此公共类用于显示提示框,对MBProgress的进一步封装.可以看下面的代码 接口: @interface MyMBProgre ...

  5. asp.net 读取一个文本文件,并输出到网页显示 通过 一般处理程序实现

    asp.net 读取一个文本文件,并输出到网页显示 通过 一般处理程序实现 用这个可以做模板首页进行输出,也可以自已自定义进行扩展 //得到读取到的文本到string中 string resultTe ...

  6. Metro中控件WebView访问外部的网页显示一片空白

    Metro中控件WebView访问外部的网页显示一片空白 解决方案: ​下载安装了Initex.Software.Proxifier.v3.21.Standard.Edition.Incl.Keyma ...

  7. python学习笔记--Django入门一 网页显示时间

    我的笔记是学习http://djangobook.py3k.cn/ 课程时做的,这个上边的文章讲的确实是非常的详细,非常感谢你们提供的知识. 上一篇随笔中已经配置好了Django环境,现在继续跟随ht ...

  8. Inno Setup 网页显示插件 webctrl (V2.1 版本)

    原文 http://restools.hanzify.org/article.asp?id=90 Inno Setup网页显示插件 webctrl能够显示所有 IE 中能够显示的东西.  引用内容 ; ...

  9. wamp安装后打开默认网页显示dir,图标红点

    首先网页显示dir,是因为服务这些没启动,跟图标红点是一个原因,解决了图标红点,就能解决只显示dir的问题. 先测试是不是端口占用问题,如图: 如果是,那就继续往下走. 单击图标左键(记住是左键),然 ...

随机推荐

  1. EF6调用存储过程,返回多个结果集处理

    链接:http://www.codeproject.com/Articles/675933/Returning-Multiple-Result-Sets-from-an-Entity-Fram 案例: ...

  2. CCPC网络赛,HDU_5842 Lweb and String

    Problem Description Lweb has a string $S$. Oneday, he decided to transform this string to a new sequ ...

  3. C++函数指针和指针函数

    本文参考http://www.prglab.com/cms/pages/c-tutorial/advanced-data/pointers.php http://blog.csdn.net/ameyu ...

  4. struts2初印象

    第一次写这么正式的文章,如果写的不好的地方,请指出. 今天玩了一下struts2,不过貌似是我被他玩了.简要笔记如下: 一.配置struts2(在eclipse Helios版本下) (1)先创建一个 ...

  5. RM-Linux驱动--Watch Dog Timer(看门狗)驱动分析

    from:http://blog.csdn.net/geekcome/article/details/6595265 硬件平台:FL2440 内核版本:2.6.28 主机平台:Ubuntu 11,04 ...

  6. 浏览器信息(Navigator)

    window.navigator 代表正在使用的浏览器的对象. ◆ window.navigator.appCodeName 返回浏览器的代码名."Mozilla" 本来是 Net ...

  7. 网站开发常用jQuery插件总结(八)标签编辑插件Tagit

    一.Tagit插件功能 提高网站交互性,增加用户体验.至于其它的功能,还真没有.用一个input text就可以替换了它.但是text没有输入提示功能,而tagit拥有这个功能.官方示例如下图: 将关 ...

  8. easy ui tree 取复选框打勾的值

    var nodes = $('#basetree').tree('getChecked'); var cnode = ''; for ( var i = 0; i < nodes.length; ...

  9. Hadoop MapReduce Next Generation - Setting up a Single Node Cluster

    Hadoop MapReduce Next Generation - Setting up a Single Node Cluster. Purpose This document describes ...

  10. 《C和指针》章节后编程练习解答参考——6.3

    <C和指针>——6.3 题目: 编写一个函数,把参数字符串中的字符反向排列. 函数原型: void reverse_string(char *string); 要求: 使用指针而不是数组下 ...