问题
I have a simple question. I know that I can prevent a form to re-submit itself when the user reloads the page by using the Post/Redirect/Get Pattern. But my question is, will this pattern work if I'm redirecting the user back to the same page where the form was submitted? I mean, I don't want to redirect the user to another page.
Any help please
Thank you
回答1:
yes, but you have to remember to redirect him without the GET params.
so you can
header('Location: same_page.php?status=done');
die();
this way you are removing the param, and you need to support the status=done
to show a message or what ever you want.
来源:https://stackoverflow.com/questions/7466330/prevent-double-form-submission-on-refresh