我想比較輸入「傳遞」與數據庫中的「傳球」。如果匹配,用戶將進入註冊表單。相同的密碼值比較返回false cakephp
即使兩個密碼的值相同,但我仍然得到'密碼不正確'的錯誤結果,並且提示:Undifined index:pass。 我使用CakePHP 2.8
這是我現在的代碼:
public function checkCodeRespondent() {
$password = $this->data['Respondent']['pass'];
if (isset($password) && !empty($password))
{
$respondent = $this->findByPass($password);
debug($respondent);
if ($this->data['Respondent']['pass'] != $respondent['pass']) {
print 'password is not correct';
} else {
print 'password is correct';
}
}
這是從數據庫
public function findByPass($pass) {
$respondent = $this->Respondent->find('first', array('conditions' => array('pass' => $pass)));
return $respondent;
}
沒有兩個都沒有散列。 – user2314339