+ 2
Password validation
How can we validate password in php?
1 ответ
0
(PHP 5 >= 5.5.0, PHP 7) password_verify ( string $password , string $hash ) : bool
example
<?php
// See the password_hash() example to see where this came from.
$hash = '$2y$07$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq';
if (password_verify('rasmuslerdorf', $hash)) {
echo 'Password is valid!';
} else {
echo 'Invalid password.';
}
?>