编辑“WordPress:Function Reference/email exists

跳转至: 导航、​ 搜索
警告:您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您登录创建一个账户,您的编辑将归属于您的用户名,且将享受其他好处。

该编辑可以被撤销。 请检查下面的对比以核实您想要撤销的内容,然后发布下面的更改以完成撤销。

最后版本 您的文本
第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 ===


这个函数检查是否已经为用户注册了电子邮件地址(<tt>$email</tt>),而且返回用户ID(或者如果不存在电子邮件地址,返回<tt>false</tt>)。也看看[[WordPress:Function Reference/username exists|username_exists]]。
== 例子 ==
== 例子 ==


===默认用法===
===默认用法===


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>false</tt>。
 
* If the E-mail does not exist, function returns <tt>false</tt>.
*如果电子邮件不存在,函数返回<tt>错误的</tt>。
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅Wordpress-mediawiki:版权的细节)。 未经许可,请勿提交受版权保护的作品!
取消 编辑帮助(在新窗口中打开)

本页使用的模板: