小白教程
所有教程
关于
Search
172.69.59.25
172.69.59.25
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Php password verify”的源代码
本页内容
上一节:
Php_password_needs_rehash
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:password_verify}}[[Category:php variable handling functions|39]] = PHP password_verify() 函数 = [[php variable handling functions#password_hash|PHP 密码散列算法]] password_verify() 函数用于验证密码是否和散列值匹配。 PHP 版本要求: PHP 5 >= 5.5.0, PHP 7 === 语法 === <sample title="" desc="" lang="php" hererun="1"> bool password_verify ( string $password , string $hash ) </sample> 参数说明: * password: 用户的密码。 * hash: 一个由 [[php password_hash|password_hash()]] 创建的散列值。 === 返回值 === 如果密码和散列值匹配则返回 TRUE,否则返回 FALSE 。 == == password_verify() 用法 == <sample title="" desc="" lang="php" hererun="1"> <?php // 想知道以下字符从哪里来,可参见 password_hash() 的例子 $hash = '$2y$07$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq'; if (password_verify('rasmuslerdorf', $hash)) { echo 'Password is valid!'; } else { echo 'Invalid password.'; } ?> </sample> 输出结果为: <sample title="" desc="" lang="php" hererun="1"> Password is valid! </sample> [[php variable handling functions#password_hash|PHP 密码散列算法]]
返回至“
Php password verify
”。
上一节:
Php_password_needs_rehash