首先要有表情包库.放在图片文件夹下



样式还没有调整:

php 读取表情展示在 web上



上代码:

后台显示的字段:

"content" => "[#&12][#&6][#&6][#&6][#&6]咋"      //[]内为表情包

$data['data']['lists'][$key]['content']=$this->fuhao_to_pic($data['data']['lists'][$key]['content']);//将数据传入转换为表情包显示
//表情包转化
private function fuhao_to_pic($str){
    $program=array();
    $arr=array();
    $str1="[#&";
    $str2="]";
    $url="http://weblocal.com/images/bqb/e_";
    for ($i=0; $i<=89; $i++) {
        $arr[$i]=$str1.$i.$str2;
        $m=$i;
        $img=$url.$m.'.png';
        $program[$i]="<img  width='22' src=$img  />";
    }
    $result=str_replace($arr,$program,$str);
    return $result;
}



相关文章:

  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
  • 2021-09-14
  • 2021-08-26
猜你喜欢
  • 2022-01-23
  • 2022-12-23
  • 2021-12-12
  • 2021-09-24
  • 2022-03-07
  • 2021-05-16
  • 2021-05-16
相关资源
相似解决方案