<?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);
}
}
Run Code Online (Sandbox Code Playgroud)
这是我在user.php中的代码.我正在哈希密码并得到这一个错误
错误:未找到类'App\Model\Entity\DefaultPasswordHasher'文件C:\ xamp\htdocs\bookmarker\src\Model\Entity\User.php行:27
Asi*_*ood 23
我错过了以下几行:
use Cake\Auth\DefaultPasswordHasher;
Run Code Online (Sandbox Code Playgroud)
这就是我收到错误的原因.
归档时间: |
|
查看次数: |
5147 次 |
最近记录: |