Problem in setting session variables

Hi All,

I am new to yii2. I am trying to pass some variable from one action to other. But not able to set property in session.


$session = Yii::$app->session;

After using below options when I tried to print $session, Type12 is not set there


1. $session['Type12'] = $postData;


2. $session->set('Type12', $postData);

But When I tried using


$_SESSION['Type12'] = $postData;

Then after print_r, I can see value in this action only.

But as I redirect to other action, I am getting blank array.

for this.


$session = Yii::$app->session;

Any help would be appreciated, if I am missing something.

Thanks.

Yii::$app->session->set(’’, ‘’); and then Yii::$app->session->get(’’);