Emlog教程:获取最近留言访客头像函数

emlog教程 2020-08-25

  本代码来自陈子文哪货, 做转载保存之用,原文如下:刚才写个模板需要在底部加一个最新访客,顺手写了个函数,需要的可以借鉴借鉴

  function getGravatar_fk($email, $s = 40, $d = ‘mm’, $g = ‘g’) {

  $hash = md5($email);

  $avatar = “http://gravatar.duoshuo.com/avatar/$hash?s=$s&d=$d&r=$g”;

  return $avatar;

  }

  //获取最新评论访客

  function comment($num){

  $t = MySql::getInstance();

  $sql = “SELECT * FROM “.DB_PREFIX.”comment WHERE mail != ” ORDER BY `cid` DESC LIMIT $num”;

  $list = $t->query($sql);

  while($row = $t->fetch_array($list)){

  $i = ‘

  • ‘;

      echo $i;

      }

      }

      调用方式:

      comment($num) //$num为调用数量

    评论 (0)
      Top