0

我刚刚在 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
                    )

            )



    )
)

我只是不知道如何找回

[角色] => 用户

4

1 回答 1

2

从这里提取

zf2 会话使用的一些示例:

会话创建:

use Zend\Session\Container;

$session = new Container('zftutorial');

检查会话中是否存在密钥:

$session->offsetExists('role')

按键从会话中获取价值:

$role= $session->offsetGet('role');

会话中的设置值:

$session->offsetSet('role', $role);
于 2013-01-30T06:40:43.390 回答