Automatic Logout after 15 minutes of inactive in php

后端 未结 8 786
悲&欢浪女
悲&欢浪女 2020-12-04 15:51

I want to destroy session if users are not doing any kind of activity on website. At that time after 5 users automatically redirect on index page. How is it possible? Is pos

8条回答
  •  孤城傲影
    2020-12-04 16:27

    Simple solution using .htaccess

    Add the below lines to your .htaccess file where 3600 is the number of seconds. Sessions will automatically be destroyed after certain time has nothing to do with the activity or inactivity.

    According to the below code session will be destroyed after 1 hour.

    php_value session.gc_maxlifetime 3600
    
    php_value session.gc_probability 1
    
    php_value session.gc_divisor 1
    

提交回复
热议问题