WordPress: Function Reference/username exists:修订间差异
(新页面: == Description == Returns the user ID if the user exists or <tt>null</tt> if the user doesn't exist. == Usage == %%% <?php if (username_exists($username)){ ... } ?> %%% == Examples ==...) |
无编辑摘要 |
||
第1行: | 第1行: | ||
== Description == | == Description == | ||
== 描述 == | |||
Returns the user ID if the user exists or <tt>null</tt> if the user doesn't exist. | Returns the user ID if the user exists or <tt>null</tt> if the user doesn't exist. | ||
如果用户存在,返回用户ID,如果用户不存在,返回<tt>零</tt>。 | |||
== Usage == | |||
== | == 用法== | ||
%%% <?php if (username_exists($username)){ ... } ?> %%% | |||
%%% <?php if (username_exists($username)){ ... } ?> %%% | %%% <?php if (username_exists($username)){ ... } ?> %%% | ||
== Examples == | == Examples == | ||
== 例子 == | |||
Use <tt>username_exists()</tt> in your scripts to decide whether the given username exists. | Use <tt>username_exists()</tt> in your scripts to decide whether the given username exists. | ||
在你的脚本中使用<tt>username_exists()</tt>判断,是否存在给定的用户。 | |||
<?php | <?php | ||
$username = $_POST['username']; | |||
if (username_exists($username)) | |||
echo "Username In Use!"; | |||
else | |||
echo "Username Not In Use!"; | |||
?> | |||
<?php | |||
$username = $_POST['username']; | $username = $_POST['username']; | ||
if (username_exists($username)) | if (username_exists($username)) | ||
第20行: | 第37行: | ||
== Paramaters == | == Paramaters == | ||
== 参数== | |||
$username — a string representing the username to check for existence | $username — a string representing the username to check for existence | ||
$username —一个字符串代表用户名,检查是否存在。 | |||
== Returns == | |||
== | == 返回== | ||
This function returns the user ID if the user exists or <tt>null</tt> if the user does not exist | This function returns the user ID if the user exists or <tt>null</tt> if the user does not exist | ||
[[WordPress:Category:Functions]] | 如果用户存在,这个函数返回用户ID,如果用户不存在,返回<tt>零</tt>。 | ||
[[WordPress:Category:Functions]] | |||
[[WordPress:Category:New page created]] | [[WordPress:Category:New page created]] | ||
[[WordPress:Category:Functions|类别:函数]] | |||
[[WordPress:Category:New page created|类别:创建的新网页]] | |||
== Further Reading == | == Further Reading == | ||
== 深入阅读== | |||
For a comprehensive list of functions, take a look at the [http://codex.wordpress.org/Category:Functions category Functions] | For a comprehensive list of functions, take a look at the [http://codex.wordpress.org/Category:Functions category Functions] | ||
关于全部的函数的列表,请看看[http://codex.wordpress.org/Category:函数类别函数] | |||
Also, see [[WordPress:Function_Reference]] | Also, see [[WordPress:Function_Reference]] | ||
也看看[[WordPress:Function_Reference|Function_Reference]] |
2008年7月19日 (六) 17:32的版本
Description
描述
Returns the user ID if the user exists or null if the user doesn't exist. 如果用户存在,返回用户ID,如果用户不存在,返回零。
Usage
用法
%%% <?php if (username_exists($username)){ ... } ?> %%%
%%% <?php if (username_exists($username)){ ... } ?> %%%
Examples
例子
Use username_exists() in your scripts to decide whether the given username exists. 在你的脚本中使用username_exists()判断,是否存在给定的用户。
<?php $username = $_POST['username']; if (username_exists($username)) echo "Username In Use!"; else echo "Username Not In Use!"; ?>
<?php
$username = $_POST['username']; if (username_exists($username)) echo "Username In Use!"; else echo "Username Not In Use!"; ?>
Paramaters
参数
$username — a string representing the username to check for existence $username —一个字符串代表用户名,检查是否存在。
Returns
返回
This function returns the user ID if the user exists or null if the user does not exist
如果用户存在,这个函数返回用户ID,如果用户不存在,返回零。
WordPress:Category:Functions
WordPress:Category:New page created
Further Reading
深入阅读
For a comprehensive list of functions, take a look at the category Functions
关于全部的函数的列表,请看看[1]
Also, see WordPress:Function_Reference 也看看Function_Reference