Answer the question
In order to leave comments, you need to log in
How to increase session time in yii?
Using the code Yii::app()->session->add($user->role,'1') you can add a session.
But how can you change the session time?
Answer the question
In order to leave comments, you need to log in
For Yii2, you need to add a timeout value with the specified number of seconds to the configuration (/config/web.php for the base application).
For example for 10 years:
$config = [
...
'components' => [
...
'session'=>[
'timeout'=>10*365*24*60*60,
],
...
],
...
];
php.net/manual/ru/session.configuration.php#ini.se...
The session lifetime is changed in the php.ini settings, through htaccess if you use Apache or through php.
Open index.php
ini_set('session.gc_maxlifetime', 120960);
ini_set('session.cookie_lifetime', 120960);
ini_set('session.save_path', __DIR__.'/../sessions/');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question