Do metaphorical metafile tags “interrupt” PHP sessions?

I use session variables to store custom display settings while their session is active.

For example, if I want to display 5 elements on a page with session variables, then there is no problem. I can manually (f5) refresh the page and still see 5 elements on the page. However, when implementing the next meta tag for automatic refresh every time the page is refreshed, it switches to the default value of 3.

<meta http-equiv="refresh" content="300">

I expect that perhaps this metadata update is causing a new session to be created, and therefore there is simply no user setting.

Does anyone have any experience with this type of problem - this is the case, and is there a known way to refresh the page and save the session?

+3
source share
2 answers

From my own experience, no, it is not, and it should not. Unless, of course, you update it after the session timeout.

Is javascript setTimeoutand the replacealternative you are considering?

<script type="text/javascript">
  window.setTimeout('location.replace(location.href)', 300 * 1000);
</script>
+2
source

You can try sending it from PHP itself using header().

header("Refresh: 300");
0
source

Source: https://habr.com/ru/post/1728145/


All Articles