开发者

Read AuthStorage, Zend Framework

开发者 https://www.devze.com 2023-01-14 01:07 出处:网络
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

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

精彩评论

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