PHP password_verify() doesn't seem to work

前端 未结 2 1065
名媛妹妹
名媛妹妹 2021-01-29 11:53

I have been going through the password_hash() and password_verify() methods in PHP and I\'ve been trying to include that in my code. I can\'t seem to g

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-29 11:59

    $signin_password=$_POST['signin_password'];
    
    $hash = password_hash($dbpassword, PASSWORD_DEFAULT);
    
    if (password_verify($signin_password, $hash)) 
    
     {
    
       echo 'Password is valid!';
    
     } 
    
     else 
    
     {
    
       echo 'Invalid password.';
    
     }
    

    Try with this :) Better option is just build your own query.

提交回复
热议问题