我正在尝试在 zend 框架中进行登录,但 PDO 给了我一个错误。我有以下功能:
public function isCorrectLogin (Application_Model_User $user){
$row = $this->_db_table->fetchRow(
$this->_db_table
->select()
->where( array ('email = ?' => $user->email,
'password = ?' => sha1(SALT.$user->password)))
);
if(empty($row)){
return false;
}
return true;
}
在我的控制器中,我使用此功能:
$oUserActions = new Application_Model_UserMapper();
$user = new Application_Model_User();
$user->email = $_REQUEST['email'];
$user->password = $_REQUEST['password'];
if($oUserActions->isCorrectLogin($user)){
echo 'validated';
}
我收到此错误:
Message: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in 'where clause'
Stack trace:
#0 C:\webserver\htdocs\photo\library\Zend\Db\Statement.php(303): Zend_Db_Statement_Pdo->_execute(Array)
#1 C:\webserver\htdocs\photo\library\Zend\Db\Adapter\Abstract.php(480): Zend_Db_Statement->execute(Array)
#2 C:\webserver\htdocs\photo\library\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select), Array)
#3 C:\webserver\htdocs\photo\library\Zend\Db\Table\Abstract.php(1575): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Table_Select))
#4 C:\webserver\htdocs\photo\library\Zend\Db\Table\Abstract.php(1437): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Select))
#5 C:\webserver\htdocs\photo\application\models\UserMapper.php(49): Zend_Db_Table_Abstract->fetchRow(Object(Zend_Db_Table_Select))
#6 C:\webserver\htdocs\photo\application\controllers\LoginController.php(31): Application_Model_UserMapper->getUserLogin(Object(Application_Model_User))
有谁知道我做错了什么?