WordPress: Function Reference/username exists:修订间差异
来自站长百科
无编辑摘要 |
无编辑摘要 |
||
第1行: | 第1行: | ||
== 描述 == | == 描述 == | ||
如果用户存在,返回用户ID,如果用户不存在,返回<tt>零</tt>。 | 如果用户存在,返回用户ID,如果用户不存在,返回<tt>零</tt>。 | ||
== 用法== | == 用法== | ||
%%% <?php if (username_exists($username)){ ... } ?> %%% | %%% <?php if (username_exists($username)){ ... } ?> %%% | ||
== 例子 == | == 例子 == | ||
在你的脚本中使用<tt>username_exists()</tt>判断,是否存在给定的用户。 | 在你的脚本中使用<tt>username_exists()</tt>判断,是否存在给定的用户。 | ||
<?php | <?php | ||
第35行: | 第17行: | ||
echo "Username Not In Use!"; | echo "Username Not In Use!"; | ||
?> | ?> | ||
== 参数== | == 参数== | ||
$username —一个字符串代表用户名,检查是否存在。 | $username —一个字符串代表用户名,检查是否存在。 | ||
== 返回== | == 返回== | ||
如果用户存在,这个函数返回用户ID,如果用户不存在,返回<tt>零</tt>。 | 如果用户存在,这个函数返回用户ID,如果用户不存在,返回<tt>零</tt>。 | ||
[[WordPress:Category:Functions|类别:函数]] | [[WordPress:Category:Functions|类别:函数]] | ||
[[WordPress:Category:New page created|类别:创建的新网页]] | [[WordPress:Category:New page created|类别:创建的新网页]] | ||
== 深入阅读== | == 深入阅读== | ||
关于全部的函数的列表,请看看[http://codex.wordpress.org/Category:函数类别函数] | 关于全部的函数的列表,请看看[http://codex.wordpress.org/Category:函数类别函数] | ||
也看看[[WordPress:Function_Reference|Function_Reference]] | 也看看[[WordPress:Function_Reference|Function_Reference]] |
2008年7月26日 (六) 09:23的版本
描述
如果用户存在,返回用户ID,如果用户不存在,返回零。
用法
%%% <?php if (username_exists($username)){ ... } ?> %%%
例子
在你的脚本中使用username_exists()判断,是否存在给定的用户。
<?php
$username = $_POST['username']; if (username_exists($username)) echo "Username In Use!"; else echo "Username Not In Use!"; ?>
参数
$username —一个字符串代表用户名,检查是否存在。
返回
如果用户存在,这个函数返回用户ID,如果用户不存在,返回零。
深入阅读
关于全部的函数的列表,请看看[1]