Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对提交的表格进行了澄清。当一个页面再次提交时,当我们再次刷新时,我不应该再次发布它。
我该怎么做?如何避免用户再次提交表单?
它可能是刷新或任何允许用户再次提交表单的东西。
在前端,您可以在提交后禁用提交按钮。
在服务器端,您可以分配一个唯一的 id 或生成的随机密钥,您可以检查重复项。
您可以做的一件事是,在您的服务器中,您可以查找发出请求的 IP 地址,并在从同一用户发送的类似请求之间设置特定的时间间隔。
如果您使用的是 PHP,您可以查找 in$_SERVER['REMOTE_ADDR']以获取 IP 地址。
$_SERVER['REMOTE_ADDR']