relation between sess_expiration and sess_time_to_

2019-08-09 23:08发布

问题:

I'm bit confused about the effect on sess_expiration time with sess_time_to_update in php/codeIgniter, Since my website will never change its url or never refresh/reload the page by itself (everything build in ajax), what will be the effect on sess_expiration in this situation also.

I'm new to php/CodeIgniter simple and detailed explanation about the above will be appreciable.

回答1:

CodeIgniter's session class will automatically regenerate it's session ID based on sess_time_to_update in seconds. The sess_expiration is how long the session should last from the last action/page load, again set in seconds.

It does not matter that your application is AJAX only, assuming CodeIgniter is handling the AJAX requests, it still uses the same session and therefore the session will continue until the last action/page load was greater than sess_expiration seconds ago.

CodeIgniter regenerates it's session ID every now and again as a security measure to prevent session fixation. This is not something that should affect your application. More on session fixation: http://en.wikipedia.org/wiki/Session_fixation



回答2:

Though you are calling pages with ajax. There is no differences. Page doesn't need to be reloaded, as long as you are sending request with ajax. both are same for your server end.

To read more about codeigniter session click here