password_hash()在验证密码时我得到bool false

时间:2016-11-15 10:02:10

标签: php

这是我的注册页面

$name=mysqli_real_escape_string($con,$_POST['name']);
$email=mysqli_real_escape_string($con,$_POST['email']);
$password=mysqli_real_escape_string($con,$_POST['password']);
$hashpass=password_hash($password,PASSWORD_DEFAULT);
$mobile=mysqli_real_escape_string($con,$_POST['phone']);
$state=mysqli_real_escape_string($con,$_POST['state']);
$city=mysqli_real_escape_string($con,$_POST['city']);

$sql=$con->prepare('insert into `user` (`name`,`email`,`password`,`mobile`,`state`,`city`) values (?,?,?,?,?,?)');
$sql->bind_param("ssssss",$name,$email,$hashpass,$mobile,$state,$city);
$sql->execute();

这是我的登录页面

$email=mysqli_real_escape_string($con,$_POST['email']);
$password=mysqli_real_escape_string($con,$_POST['password']);   
$pass=password_hash($password,PASSWORD_DEFAULT);
$sql="select `email`,`name`,`password` from `user` where `email`='$email' LIMIT 1";
$result=mysqli_query($con,$sql) or die(mysqli_error($con));
$row=mysqli_fetch_array($result);
var_dump(password_verify($row['password'],$pass));

验证我的密码时为什么我会得到bool(false)

0 个答案:

没有答案