Emlog最近访客调用代码
代码如下:
<?php
/**
* 获取Gravatar头像
*/
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 = '<li><a rel="nofollow" href="'.$row['url'].'"><img src="'.getGravatar_fk($row['mail']).'"></a></li>';
echo $i;
}
}
?>
在需要的地方调用:<?php comment($num) //$num为调用数量 ?>
发表评论