百度 | 神马 | 搜狗 | 技术文档 | 学习资料分享 - 记录帝国CMS及运维技术的点点滴滴
你的位置:首页 > 实用IT技术 » 正文

【Wordpress相关】WordPress 常用函数 / sanitize_user

发布时间:2020-09-17

WordPress 常用函数 / sanitize_user,

简介

清理用户名,去掉所有不安全的字符。

删除 HTML 标签,8进制,HTML实体,如果 $strict 参数设置为 true,将删除所有非 ASCII 字符,只保留数字,字母,_,空格,.,-,@。

用法

<?php sanitize_user( $username, $strict ) ?>

参数

$username
(string) (required) 要清理的用户名。
Default: None

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script>

$strict
(boolean) (optional) 如果设置为 true,限制 $username 为数字,字母,_,空格,.,-,@。
Default: false

返回值

(string)
The sanitized username, after passing through filters.

修改记录

Since: 2.0.0

源文件

wp-includes/formatting.php

Top