WordPress 判断邮箱是否设置了头像,做一下记录,下面有代码出处。文章源自知更鸟-https://zmingcx.com/wordpress-judge-mailbox-avatar.html
function validate_gravatar($email) { // Craft a potential url and test its headers $hash = md5(strtolower(trim($email))); $uri = 'http://www.gravatar.com/avatar/' . $hash . '?d=404'; $headers = @get_headers($uri); if (!preg_match("|200|", $headers[0])) { $has_valid_avatar = FALSE; } else { $has_valid_avatar = TRUE; } return $has_valid_avatar; }
文章源自知更鸟-https://zmingcx.com/wordpress-judge-mailbox-avatar.html
代码出处:https://stackoverflow.com/questions/32755354/check-if-a-user-has-a-gravatar-wordpress
文章源自知更鸟-https://zmingcx.com/wordpress-judge-mailbox-avatar.html
版权声明
本站原创文章转载请注明文章出处及链接,谢谢合作!
评论