Prevent session expired in PHP Session for inactive user

后端 未结 5 587
傲寒
傲寒 2020-12-05 03:17

I have a problem with my application: my application has many forms and need about 1 hour to finish this form because the form is dynamic (can add other forms). The problem

5条回答
  •  隐瞒了意图╮
    2020-12-05 03:43

    Here an example to prevent session timeout by using a jQuery Ajax call:

    var refreshTime = 600000; // every 10 minutes in milliseconds
    window.setInterval( function() {
        $.ajax({
            cache: false,
            type: "GET",
            url: "refreshSession.php",
            success: function(data) {
            }
        });
    }, refreshTime );
    

    in the refreshSession.php you can do something like session_start()

提交回复
热议问题