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?

How does Thinkphp prevent users from adding a piece of data multiple times when the network is not smooth or intentionally refreshed?

WBOY
Release: 2016-07-06 13:52:04
Original
1361 people have browsed it

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 does Thinkphp prevent users from adding a piece of data multiple times when the network is not smooth or intentionally refreshed?

How can I stop this kind of thing?

Reply content:

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 does Thinkphp prevent users from adding a piece of data multiple times when the network is not smooth or intentionally refreshed?

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

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template