gpt4 book ai didi

php - 未找到 Laravel 类 'HASH'

转载 作者:行者123 更新时间:2023-12-03 18:11:10 25 4
gpt4 key购买 nike

验证规则后,我想检查当前输入的密码宽度保存在数据库上的哈希密码。我正在使用以下代码,但出现错误:

错误代码:

Symfony \ Component \ Debug \ Exception \ FatalErrorException

Class 'HASH' not found

我的 Controller 操作:
public function update($id)
{
$rules = array(
'name' => 'required|alpha',
'family' => 'required',
'email' => 'required',
'password' => 'required|confirmed',
'password_confirmation'=>'required',
);

$validator = Validator::make(Input::all(), $rules);

if ($validator->fails()) {
return Redirect::to('/admin/profile')
->withErrors($validator)
->withInput();
}
else
{
$currentPassword = User::find($id);
if ( $currentPassword == HASH::make(Input::get('currpassword')) ){
return Redirect::route('/admin/profile')
->with('message', 'Password Match Error')
->withInput();
}

}
}

最佳答案

我也遇到过这个问题。但最终找到了解决问题的方法。请在您的代码文件顶部包含以下路径。然后它可能会修复。

use Illuminate\Support\Facades\Hash;

关于php - 未找到 Laravel 类 'HASH',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21477684/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com