Home >Backend Development >PHP Tutorial >How does Thinkphp prevent users from adding a piece of data multiple times when the network is not smooth or intentionally refreshed?
When I added data, I refreshed the webpage many times, causing an item to be added repeatedly for several days
There must be a user who will read the message when the network is not good, and then the user will refresh and the tragedy will happen
How can I stop this kind of thing?
When I added data, I refreshed the webpage many times, causing an item to be added repeatedly for several days
There must be a user who will read the message when the network is not good, and then the user will refresh and the tragedy will happen
How can I stop this kind of thing?
Use session, session is data that acts on the server side. As long as it is planted once and is not refreshed, its value will not be changed. You can use this to prevent users from repeatedly submitting data
Your problem is actually about preventing repeated submission of the form. You can generate a token and put it in the session, and also put a copy in the form, and then verify the token passed from the form and clear the session