我刚刚在ZF2上的Session上转储了
Zend\Session\Storage\SessionStorage Object
(
[isImmutable:protected] =>
[storage:ArrayObject:private] => Array
(
[__ZF] => Array
(
[_REQUEST_ACCESS_TIME] => 1359526796.5079
[FlashMessenger] => Array
(
[EXPIRE_HOPS] => Array
(
[hops] => 1
[ts] => 1359526775.9345
)
)
)
[FlashMessenger] => ArrayObject Object
(
[storage:ArrayObject:private] => Array
(
[default] => Zend\Stdlib\SplQueue Object
(
[flags:SplDoublyLinkedList:private] => 4
[dllist:SplDoublyLinkedList:private] => Array
(
[0] => Authentication successful.
)
)
)
)
[zf_tutorial] => ArrayObject Object
(
[storage:ArrayObject:private] => Array
(
[storage] => hello
)
)
[zftutorial] => ArrayObject Object
(
[storage:ArrayObject:private] => Array
(
[role] => user
)
)
)
)
我只是不知道如何获取检索
[role] =>用户
答案 0 :(得分:2)
摘自here
zf2会话使用的一些示例:
会话创建:
use Zend\Session\Container;
$session = new Container('zftutorial');
检查会话中是否存在密钥:
$session->offsetExists('role')
按键从会话中获取值:
$role= $session->offsetGet('role');
在会话中设置值:
$session->offsetSet('role', $role);