1

インターネットで検索していました。アクションでセッションを使用したい。そして、私はコードを持っています:

module.config.php で:

return array(
            'remember_me_seconds' => 360,
            'name'                => 'zf2',
            'use_cookies' => true,
            'cookie_httponly' => true,
    ),
);

Module.php で

public function onBootstrap(MvcEvent $e)
    {

        $config = $e->getApplication()->getServiceManager()->get('Configuration');

        $sessionConfig = new SessionConfig();
        $sessionConfig->setOptions($config['session']);
        $sessionManager = new SessionManager($sessionConfig);
        $sessionManager->start();

        /**
         * Optional: If you later want to use namespaces, you can already store the
         * Manager in the shared (static) Container (=namespace) field
         */
        Container::setDefaultManager($sessionManager);
    }

コントローラーで:

    public function updatesessionAction(){

            $key = $this->getEvent()->getRouteMatch()->getParam('key');
            $value = $this->getEvent()->getRouteMatch()->getParam('value');

            $this->userSession = new Container($this->sessionNameSpace);
            $this->userSession->offsetSet($key,$value);
}

実行されますが、時間切れは常に = 180 秒です。私の設定のように360秒ではありません。値が 180 の場所がわかりません。 config のように設定するには何が必要ですか?

4

0 に答える 0