gpt4 book ai didi

cakephp-3.0 - 错误 : Class 'App\Model\Entity\DefaultPasswordHasher' not found

转载 作者:行者123 更新时间:2023-12-04 01:37:48 25 4
gpt4 key购买 nike

<?php
namespace App\Model\Entity;

use Cake\ORM\Entity;

/**
* User Entity.
*/
class User extends Entity
{

/**
* Fields that can be mass assigned using newEntity() or patchEntity().
* Note that '*' is set to true, which allows all unspecified fields to be
* mass assigned. For security purposes, it is advised to set '*' to false
* (or remove), and explicitly make individual fields accessible as needed.
*
* @var array
*/
protected $_accessible = [
'*' => true,
'id' => false,
];

protected function _setPassword($value)
{
$hasher = new DefaultPasswordHasher();
return $hasher->hash($value);
}
}

这是我在 user.php 中的代码。
我正在对密码进行哈希处理,但出现了这个错误

Error: Class 'App\Model\Entity\DefaultPasswordHasher' not found File C:\xamp\htdocs\bookmarker\src\Model\Entity\User.php Line: 27

最佳答案

我错过了以下行:

use Cake\Auth\DefaultPasswordHasher;

这就是我收到错误的原因。

关于cakephp-3.0 - 错误 : Class 'App\Model\Entity\DefaultPasswordHasher' not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32506263/

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