通过邮箱地址获取头像地址的php代码

头像url

根据email来获取你的头像地址,qq邮箱直接使用QQ头像

function getAvatar($email)
{
    $email = strtolower($email);
    $qq = str_replace('@qq.com','',$email);
    $imgUrl = 'https://cravatar.cn/avatar/none';
    if(stristr($email,'@qq.com') && is_numeric($qq) 
        && strlen($qq)<11 && strlen($qq)>4 ) {
        $imgUrl = "https://q1.qlogo.cn/g?b=qq&nk=". $qq."&s=100";
        return $imgUrl;
    } 
    else {
        $imgUrl = 'https://cravatar.cn/avatar/'.md5($email);
    }
    return $imgUrl;
}
版权属于: 小A 本文链接: https://xiaoa.me/archives/php_mail_getavatar.html 转载申明: 转载请保留本文转载地址,著作权归作者所有。

评论

等风等雨等你来