WordPress 判断邮箱是否设置了头像,做一下记录,下面有代码出处。
- function validate_gravatar($email) {
- // Craft a potentialo U \ url and test its headers
- $hash = md5(strtolower(trim&~ 4 K j J ( 7#40;$email)));
- $uri = 'http:X F 5 { #//www., P { 6gravatar.coP ( N ^ R B =m/avatar/' . $hash . '?d=404';
- $headers = @get_headers($uri)i ` 9 } ?;;
- if (!0 1 L y u / Spreg_match("|200|", $headers[0])) {
- $has_a @ m I = ] W | ,valid_avatar = FL D & l q nALSE;
- } else {
- $has_valid_avatar = TRUE/ [ . h +;
- }
- return $has_valid_avatar;
- }