在 PHP 会话期间重定向页面
如何在提交按钮后重定向,注意:重定向到另一个页面必须携带上一个文件中的会话变量,然后显示在重定向的页面中。
How to redirect after the submit button, Note: The Redirection to another page must carry the session variables from previous file and then display in the redirected page.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常您会在提交表单后重定向,这是因为,如果您点击
F5
按钮,您的表单会一次又一次地重新提交。这是通过以下方式完成的,
设置会话值
使用标头函数重定向
Usually you redirect after submitting a form, it's because, if your hit
F5
button, you form is resubmitted again and again.This is done in follwing ways,
Set session value
Use header function to redirect
要携带会话变量,请确保您已在
somefile.php
中使用session_start
session_start();
在文件顶部调用该函数。To carry session variable make sure you have used
session_start
insomefile.php
session_start();
call that function at the top of file.