[TP3.2.*] Solve the problem of session expiration and setting failure

1. Background: Originally, I wanted to set the session validity period to 1800 seconds, that is, 30 minutes, but when I actually used TP3.2.0, I found that the user did not fail after logging in for a few days, and he could log in all the time.

2. Solve:

  2.1 Set the SESSION_OPTIONS array in config.php

/* SESSION global configuration */ 
    'SESSION_OPTIONS' => array (
         'path' => RUNTIME_PATH . 'Temp/',
        'use_cookies' => 1,          // whether to use cookies to store session IDs on the client side, 1 is to enable 
        'use_trans_sid' => true ,     // pass across pages 
        'expire' => 1800, 
    ) ,

  2.2 1074 modifications in common/function.php:

  Will 

if(isset($name['expire']))          ini_set('session.gc_maxlifetime', $name['expire']);

  changed to:

if(isset($name['expire'])){ini_set('session.gc_maxlifetime', $name['expire']);ini_set('session.cookie_lifetime', $name['expire']);}

  Save, clear the cache under the browser and server RunTime/Temp, log in to the page again, and wait for the expiration. (You can set expire=10 when testing)

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325030918&siteId=291194637