您的当前位置:首页 > 知识博客 > wordpress建站

WordPress用户名格式有效性检测函数:validate_username

时间:2024-03-09

WordPress函数validate_username用于验证用户名的格式是否有效,如果有效返回true,无效返回false。

validate_username( string $username )

函数参数

$username

字符串

用户登录名

函数使用示例

if(!empty($_POST['username']) && validate_username($_POST['username'])) {
    //有效的用户名
}

扩展阅读

validate_username()函数位于:wp-includes/user.php

相关函数:

  • sanitize_user()

  • edit_user()

  • register_new_user()

  • username_exists()

  • email_exists()


欢迎咨询/Welcome to inquire
tel/vx:18842938855
qq:1685522781
email:1685522781@qq.com

Copyright © 2019-2024 sex.cyou


Whatsapp
Powered by RRZCMS