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[抓狂][可爱]');

评论

  • 먹튀검증커뮤니티 回复

    Fantastic beat ! I would like to apprentice while you amend your website, how can i subscribe for a blog website? The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast provided bright clear concept

  • GLS-1000 Manual 回复

    What's up, yes this piece of writing is truly fastidious and I have learned lot of things from it about blogging. thanks.

  • Geo XT 3000 Series Manual 回复

    Quality articles is the important to interest the users to pay a quick visit the web page, that's what this web site is providing.

  • MC-R3 回复

    Helpful information. Fortunate me I found your site accidentally, and I am stunned why this twist of fate did not happened in advance! I bookmarked it.

  • RL-200 2S Data Sheet 回复

    This post is genuinely a fastidious one it assists new web viewers, who are wishing in favor of blogging.

  • trimble r8 Model 2 data sheet 回复

    My partner and I stumbled over here different web address and thought I might as well check things out. I like what I see so now i'm following you. Look forward to exploring your web page yet again.

  • Topcon QS3 Spec Sheet 回复

    I constantly spent my half an hour to read this weblog's posts all the time along with a mug of coffee.

  • Leica iCON grade iGx3 回复

    Wow, this post is fastidious, my sister is analyzing these things, so I am going to tell her.

  • moving equipment 回复

    Ahaa, its good discussion regarding this piece of writing here at this website, I have read all that, so at this time me also commenting here.

发表评论