PHP session variable changes between pages

后端 未结 4 1912
一个人的身影
一个人的身影 2021-01-06 04:09

I have a session variable that I set like this:



        
4条回答
  •  太阳男子
    2021-01-06 05:01

    You will notice that every time you revisit the first page, your session variable will change. Since it works for a constant string, 'example', I will assume that you revisit page 1 to view what is stored there.

    A fix could be checking to ensure that that session variable is not set before you set it again. i.e.

    
    

    This chunk of code should work as expected.

提交回复
热议问题