Eric T
Eric T

Reputation: 1026

PHP Session set into variable and unset it.

just a quick question.

I'm trying to store a session into a variable and then in the second line I try to unset the session. There after my variable become empty.

//Assuming session Hello has a value already

$hello_world = $this->Session->read('Hello');
$this->Session->delete('Hello');

print_r($hello_world); //empty here where it shouldn't ...

Upvotes: 0

Views: 91

Answers (2)

Moax6629
Moax6629

Reputation: 378

try to echo the variable since it is not an array. if doesn't work then u have to post your whole view.

Upvotes: 1

GautamD31
GautamD31

Reputation: 28763

You are deleting the session variable with

$this->Session->delete('Hello');

SO the session variable with name Hello will be deleted from the session.See this LINK

Upvotes: 1

Related Questions