Destroy PHP session on page leaving

前端 未结 7 1217
轻奢々
轻奢々 2020-12-06 02:52

I need to destroy a session when user leave from a particular page. I use session_destroy() on the end of the page but its not feasible for me because my page h

7条回答
  •  孤街浪徒
    2020-12-06 03:12

    I had a similar issue but mine was on a page reload I wanted variables that I had printed to be destroyed. It was for my login for my web design class I was making error feed back for if user put in a bad username or password. I could get the error to display but if I hit refresh page they errors would just stay there. I found that by just setting the variable to nothing after it printed would kill it. Take a look at what i did:

    To access my website please Login:

    Username:

    Password:
    or you can Register

    I don't know if this helps at all but it worked for me.

    Also, thanks to all you that post on sites like this to help those of us who are still learning.

提交回复
热议问题