Pervaiz Iqbal
Pervaiz Iqbal

Reputation: 326

Zend2 Destroying SessionCookie

i am setting cookie in my app, i want to destroy the old cookie when it find the secure HTTPS chanel. this is the code that i used to destroy the session Cookie

            if($cookie['secure'] == 1 && isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')
            {
                \Zend_Session::destroy( true );

                return $this->redirect()->toRoute('main_login');

            }

but it show me blank page, and session is not destroying.

Upvotes: 1

Views: 65

Answers (1)

peterpeterson
peterpeterson

Reputation: 1315

Let say you have a container:

$session = new Container('bar');

You've got 3 different ways to unset:

unset($session['bar']);

unset($session->bar);

$session->offsetUnset('bar');

Or clear:

$session->getManager()->getStorage()->clear('bar');

Upvotes: 1

Related Questions