php session problems when opening multiple window tabs

后端 未结 3 592
礼貌的吻别
礼貌的吻别 2021-01-26 12:39

I have a php page that starts with a session_start() and it stores the user info in the session variables. After that it goes either into (1) the long loop script does calcula

相关标签:
3条回答
  • 2021-01-26 13:03

    It sounds like the problem isn't with the session in multiple windows, but with the first script running the long loop before outputting any headers, specifically the session ID cookie that other pages would need to use the same session. You should probably start the session and store your variables and then either redirect the user to another page for the long loop or output some kind of content, such as "Welcome! Starting Long Loop..."

    0 讨论(0)
  • 2021-01-26 13:14

    I think I just solved it. Instead of using session_destroy(), session_write_close() would solve this problem.

    0 讨论(0)
  • 2021-01-26 13:27

    you dont need to do that,

    when u call session_start(); a session is created and it is active until the timeout in php.ini or you call session_destroy();

    your error is somewhere else, do you call session_start after echo or print?

    0 讨论(0)
提交回复
热议问题