开发者

Zend Framework - storing and retrieving cookies

I try to put the user's email in a cookie when he logs in, and retrieve it at his next visit. The code below doesn't work, obviously I am missing something.

When user submits login info, store the email in cookie: $cookie = new Zend_Http_Cookie('emailLogin', urlencode($email), 'localhost');

At开发者_JAVA技巧 the next user's visit, retrieve the user's email: $email = $this->_request->getCookie('emailLogin');

(I had already a debate in #zftalk on why I need to store the email in cookie, I don't want to discuss that again please)


That is not what Zend_Http_Cookie is for, see php setcookie vs Zend_Http_Cookie. Try just using the native PHP setcookie method, or sessions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜