use yii\web\Session; $session = Yii::$app->session; // start session $session->open(); // close session $session->close(); // destroys session. $session->destroy(); //store value in session $session['user_id'] = 2; echo $session['user_id']; //result will be 2 // check if a session is set if ($session->isActive) //unset session variable unset($_SESSION['user_id']);
Wednesday, May 2, 2018
yii2 session handling
Subscribe to:
Post Comments (Atom)
Recent Update
yii2 session handling
use yii\web\Session; $session = Yii::$app->session; // start session $session->open(); // close session $session->close(); ...
Most Search
-
You can easily generate random string using security class. Yii2 generate unique number $string = Yii::$app->security->generateR...
-
For implementing this you need to call default modal of Yii2 and begin and end modal is must In step 2 you need to add javascipt for cal...
-
kartik Select2 onChange and Ajax Call In this example you can see a function userAlert() and this will call after typing in select2 text...
ReplyDeleteWonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!
Offshore Yii Framework Development in India