laravel Hash密码 校对
laravel加密 是使用hash不可逆的,但是可以对加密后的密码进行校对
$data = $r->all();
$id = $data['id'];
$user_password = bcrypt($data['user_password']);
//检验老密码是否正确
$res_password = \DB::table('user')
->where('id',$id)
->first()->user_password;
$user_old_password = $data['user_old_password'];
if(!Hash::check($user_old_password, $res_password)){
return ['code' => 1002, 'data' => ['message' => '原密码错误!']];
}