编辑“WordPress:Function Reference/email exists”
该编辑可以被撤销。 请检查下面的对比以核实您想要撤销的内容,然后发布下面的更改以完成撤销。
最后版本 | 您的文本 | ||
第1行: | 第1行: | ||
==Description== | |||
== 描述 == | == 描述 == | ||
This function will check whether or not a given email address (<tt>$email</tt>) has already been registered to a username, and returns that users ID (or <tt>false</tt> if none exists). See also [[WordPress:Function Reference/username exists|username_exists]]. | |||
这个函数检查是否已经为用户注册了电子邮件地址(<tt>$email</tt>),而且返回用户ID(或者如果不存在电子邮件地址,返回<tt>错误的</tt>)。也看看[[WordPress:Function Reference/username exists|username_exists]]。 | |||
== Examples == | |||
=== Default Usage === | |||
== 例子 == | == 例子 == | ||
===默认用法=== | ===默认用法=== | ||
This function is normally used when a user is registering, to ensure that the E-mail address the user is attempting to register with has not already been registered. | |||
<?php if ( email_exists($email) ) { . . . } ?> | <?php if ( email_exists($email) ) { . . . } ?> | ||
用户注册时,通常使用这个函数,确认用户试图注册的电子邮件地址,还没有注册。 | 用户注册时,通常使用这个函数,确认用户试图注册的电子邮件地址,还没有注册。 | ||
=== Detailed Example === | |||
=== 详细的例子 === | === 详细的例子 === | ||
If the E-mail exists, echo the ID number to which the E-mail is registered. Otherwise, tell the viewer that it does not exist. | |||
如果电子邮件存在,echo电子邮件注册的ID数字。否则的话,通知访客不存在这个电子邮件。 | 如果电子邮件存在,echo电子邮件注册的ID数字。否则的话,通知访客不存在这个电子邮件。 | ||
<pre><?php | |||
$email = 'myemail@example.com'; | |||
if ( email_exists($email) ) | |||
echo "That E-mail is registered to user number " . email_exists($email); | |||
else | |||
echo "That E-mail doesn't belong to any registered users on this site"; | |||
?></pre> | |||
<pre><?php | <pre><?php | ||
第21行: | 第41行: | ||
echo "这封电子邮件不属于这个站点上任何注册的用户"; | echo "这封电子邮件不属于这个站点上任何注册的用户"; | ||
?></pre> | ?></pre> | ||
== Parameter == | |||
== 参数== | == 参数== | ||
{{Parameter|$email|string|The E-mail address to check|required}} | |||
{{Parameter|$email|string|需要确认的电子邮件地址|required}} | {{Parameter|$email|string|需要确认的电子邮件地址|required}} | ||
== Return == | |||
== 返回 == | == 返回 == | ||
* If the E-mail exists, function returns the ID of the user to whom the E-mail is registered. | |||
*如果电子邮件存在,函数返回已经注册电子邮件的用户的ID。 | *如果电子邮件存在,函数返回已经注册电子邮件的用户的ID。 | ||
*如果电子邮件不存在,函数返回<tt> | |||
* If the E-mail does not exist, function returns <tt>false</tt>. | |||
*如果电子邮件不存在,函数返回<tt>错误的</tt>。 |