经测试代码如下:
/**
* 获取Gravatar头像
*
* http://en.gravatar.com/site/implement/images/
* @param $email
* @param $s size
* @param $d default avatar
* @param $g
* @author 编程之家 jb51.cc jb51.cc
*/
function getGravatar($email,$s = 40,$d = 'mm',$g = 'g') {
$hash = md5($email);
$avatar = "http://www.gravatar.com/avatar/$hash?s=$s&d=$d&r=$g";
return $avatar;
}
原文链接:https://www.f2er.com/php/529182.html