在Zend 1中需要使用Cookie而不是Session for auth

时间:2015-09-05 06:56:06

标签: php authentication zend-framework session-cookies

我有一个带有zend 1的应用程序,有一个验证示例

$adapter = $this->getAuthAdapter($form->getValues());
$auth = Zend_Auth::getInstance();
$result = $auth->authenticate($adapter);

Zend_Auth使用会话存储,我想更改它并使用Cookie代替Session

有没有办法用config做到这一点,或者我必须更改Zend Storage?

1 个答案:

答案 0 :(得分:2)

您的问题的基本答案在文档Zend Auth: Implementing Customized Storage中。正如您所发现的,默认存储是基于会话的,并且没有其他选项,但正如本章所述,您可以编写自己的实现。

我为应用程序编写了一次cookie实现,这非常简单。如果我能再次找到它,我可以在github上发布它。