创建纯文本密码的哈希(加密)。
原型
wp_hash_password( string $password )
描述
为了与其他应用程序集成,可以覆盖此功能,而不是使用其他程序包密码检查算法。
参数
$password
(string)
(Required)
用于散列的纯文本用户密码
返回值
(string)
密码的哈希字符串
源文件
路径:wp-includes/pluggable.php
<?php
...
function wp_hash_password($password) {
global $wp_hasher;
if ( empty($wp_hasher) ) {
require_once( ABSPATH . WPINC . '/class-phpass.php');
// By default, use the portable hash from phpass
$wp_hasher = new PasswordHash(8, true);
}
return $wp_hasher->HashPassword( trim( $password ) );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_hash_password/