我試着使用:Zend_Auth的檢查,如果用戶登錄
// do login if request is posted
if (isset($_POST) && !empty($_POST)) {
// do authencation
...
} else {
// request not posted
// see if already logged in
if (Zend_Auth::getInstance()->hasIdentity()) {
echo "already logged in as: " . Zend_Auth::getInstance()->getIdentity();
}
}
Zend_Auth::getInstance()->hasIdentity()
似乎從來都是假的......即使登錄
檢查cookie,會話? – 2009-09-24 08:23:47
你如何做你的認證?你如何確保它被持續?如果你已經完成認證,hasIdentity將返回true! – markus 2009-09-24 08:28:06
我使用Zend_Auth進行身份驗證,http://framework.zend.com/manual/en/zend.auth.html#zend.auth.introduction.persistence.default,根據該$ result-> getIdentity()=== $ auth->的getIdentity() – iceangel89 2009-09-24 10:39:38