Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
email_exists() - 判断给定的电子邮箱是否存在 - WordPress函数 - WordPress动力
当前浏览:首页 / WordPress函数 / email_exists()

email_exists( string $email )

判断给定的电子邮箱是否存在


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 2 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "ca7d50c0c7e49a5d13c05032d944f97a" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "2df702d60daa556bbc409461c8106fdb" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

email

exists 判断存在


描述

更多类似的主题函数信息,请查看主题开发手册中的条件标签文章。


参数

$email

(string)(必填) 检查是否存在的电子邮件。


返回

(int|false) 成功时为用户ID,失败时为false。


说明

此函数将检查给定的电子邮箱地址($email)是否已注册到用户名,并返回该用户ID(如果不存在,则返回false)。另见username_exists。

此函数通常在用户注册时使用,以确保用户试图注册的电子邮件地址尚未注册。



源码

查看源码 官方文档


更新日志

版本描述
2.1.0开始引入

使用示例

  • 示例1

    示例
    如果电子邮件存在,则回显电子邮件注册的ID号。否则,告诉查看者它不存在。

    $email = 'myemail@example.com';
    $exists = email_exists( $email );
    if ( $exists ) {
    	echo "That E-mail is registered to user number " . $exists;
    } else {
    	echo "That E-mail doesn't belong to any registered users on this site";
    }
    
  • 示例2

    请记住:SHORTINIT中没有定义此函数