加密和解密cakephp 3安全组件

时间:2016-01-17 19:15:36

标签: cakephp cakephp-3.1

CakePHP 3中此代码有什么问题?

crypt函数没问题,但是当我尝试解密密码时,它返回false。

  public function beforeSave($event){
    if(isset($event->data['entity']["password"])){
      $event->data['entity']["password"] =  Security::encrypt($event->data['entity']["password"], Security::salt());
    }
  }

  public function readPassword($pass){
     $result = Security::decrypt($pass, Security::salt());
     echo $result;
     die();
  }

0 个答案:

没有答案