开发者

Read AuthStorage, Zend Framework

on my project website users are able to login and move from page to page on my site by being logged in. so they do not have to log in again for moving to another section on my page. to achieve that I use the storage of Zend_Auth.

Following code shows how I write storage:

$authAdapter->setIdentity($email)
        ->setCredential($password);

...

$identity = $authAdapter->g开发者_运维问答etResultRowObject(); 
$authStorage = $auth->getStorage();
$authStorage->write($identity);

Now I try to read this storage in another controller:

$auth = Zend_Auth::getInstance();
$authStorage = $auth->getStorage();
$user = $authStorage->read()->email;

...but $user stays null. any ideas how to solve that problem?


This line jumped out at me:

$user = $authStorage->read()->email;

It doesnt appear that you set the "email" anywhere but a username and password for a person.

Try this

print_r($authStorage->read());
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜