php 解析表情

  • 2016-11-14 12:02:36

<?php
$face = array(
    array("微笑" => "0_微笑.gif"), 
    array("撇嘴" => "1_撇嘴.gif"), 
    array("色" => "2_色.gif"), 
    array("发呆" => "3_发呆.gif"), 
    array("得意" => "4_得意.gif"), 
    array("流泪" => "5_流泪.gif"), 
    array("害羞" => "6_害羞.gif"), 
    array("闭嘴" => "7_闭嘴.gif"), 
    array("大哭" => "9_大哭.gif"), 
    array("尴尬" => "10_尴尬.gif"), 
    array("发怒" => "11_发怒.gif"), 
    array("调皮" => "12_调皮.gif"), 
    array("龇牙" => "13_龇牙.gif"), 
    array("惊讶" => "14_惊讶.gif"), 
    array("难过" => "15_难过.gif"), 
    array("酷" => "16_酷.gif"), 
    array("冷汗" => "17_冷汗.gif"), 
    array("抓狂" => "18_抓狂.gif"), 
    array("吐" => "19_吐.gif"), 
    array("偷笑" => "20_偷笑.gif"), 
    array("可爱" => "21_可爱.gif"), 
    array("白眼" => "22_白眼.gif"), 
    array("傲慢" => "23_傲慢.gif"), 
    array("饥饿" => "24_饥饿.gif"), 
    array("困" => "25_困.gif"), 
    array("惊恐" => "26_惊恐.gif"), 
    array("流汗" => "27_流汗.gif"), 
    array("憨笑" => "28_憨笑.gif"), 
    array("大兵" => "29_大兵.gif"), 
    array("奋斗" => "30_奋斗.gif"), 
    array("咒骂" => "31_咒骂.gif"), 
    array("疑问" => "32_疑问.gif"), 
    array("嘘" => "33_嘘.gif"), 
    array("晕" => "34_晕.gif"), 
    array("折磨" => "35_折磨.gif"), 
    array("衰" => "36_衰.gif"), 
    array("骷髅" => "37_骷髅.gif"), 
    array("敲打" => "38_敲打.gif"), 
    array("再见" => "39_再见.gif"), 
    array("擦汗" => "40_擦汗.gif"), 
    array("抠鼻" => "41_抠鼻.gif"), 
    array("鼓掌" => "42_鼓掌.gif"), 
    array("糗大了" => "43_糗大了.gif"), 
    array("坏笑" => "44_坏笑.gif"), 
    array("左哼哼" => "45_左哼哼.gif"), 
    array("右哼哼" => "46_右哼哼.gif"), 
    array("哈欠" => "47_哈欠.gif"), 
    array("鄙视" => "48_鄙视.gif"), 
    array("委屈" => "49_委屈.gif"), 
    array("快哭了" => "50_快哭了.gif"), 
    array("阴险" => "51_阴险.gif"), 
    array("亲亲" => "52_亲亲.gif"), 
    array("吓" => "53_吓.gif"), 
    array("可怜" => "54_可怜.gif"), 
    array("菜刀" => "55_菜刀.gif"), 
    array("西瓜" => "56_西瓜.gif"), 
    array("啤酒" => "57_啤酒.gif"), 
    array("篮球" => "58_篮球.gif"), 
    array("乒乓" => "59_乒乓.gif"), 
    array("拥抱" => "78_拥抱.gif"), 
    array("握手" => "81_握手.gif"), 
    array("得意地笑" => "得意地笑.gif"), 
    array("听音乐" => "听音乐.gif"));
foreach ($face as $k => $item)
{
    $a   = array_keys($item);
    $b[] = '[' . $a[0] . ']';
}
$GLOBALS['qqface_maps'] = array_values($b);
function qqface_convert_html($text)
{
    return str_replace($GLOBALS['qqface_maps'], array_map("add_img_label", str_replace(array('[', ']'), '', array_values($GLOBALS['qqface_maps']))), htmlspecialchars_decode($text, ENT_QUOTES));
}
function add_img_label($v)
{
    return '<img src="https://res.wx.qq.com/mpres/htmledition/images/icon/emotion/' . $v . '.gif" width="24" height="24">';
}

echo qqface_convert_html('sdf[白眼]sdfs[抓狂][可爱]');

评论

  • Сialis 回复

    This post gives clear idea in favor of the new users of blogging, that actually how to do blogging.

  • folder-lock.indir.biz 回复

    Grеetings from California! I'm bored to deɑth at work so I decided to browse your sitе on my iphone durіng lunch break. I love the information yօu preѕent here and ϲan't wait to take a look when I get hοme. I'm surprised at how fast your blog loaded

  • Hilda 回复

    I know this web site provides qᥙality depending articles and other data, is there any other weƅ site which gives these kinds of information in quality? address : You Knew How To Pаssword Protеct Folder But You Forgot. Here Is A Reminder

  • www.selfgrowth.com 回复

    Ηi, this weekend is fastidious desіgned for me, as this moment i am reaԀing this enormous infⲟrmative post here at my houѕe. news : Seven Waʏs To Improve Еncryption Software & The Dangers Ⲟf How To Encrypt A Password For Freeing Too Much

  • ΝΤΕΤΕΚΤΙΒ 回复

    An interesting discussion is definitely worth comment. There's no doubt that that you should write more about this topic, it might not be a taboo subject but usually folks don't talk about such subjects. To the next! Kind regards!!

    • 说的什么意思

发表评论