发布后重定向? [英] redirect after post?

查看:62
本文介绍了发布后重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于提交简历的php页面.一旦他们单击提交,他们会将所有帖子信息发送到mail.php

I have a php page for submitting resumes. once they click submit they info all posts to mail.php

发送邮件后,我希望用户返回网站上的其他页面(工作机会所在的页面)

once the mail is sent i would like the user to go back to a different page on the website (where the job opportunity are located)

在完成mail.php的业务后,是否可以使用任何类型的命令重定向到其他页面?

is is there any sort of command i can use to redirect to a different page after the mail.php is done with its business??

谢谢

推荐答案

在相关说明中,关于PHP标头命令的一件重要事情,必须确保在该页面上显示任何内容之前运行此命令.运行它,否则它将无法正常工作.

On a related note, one important thing about the PHP header command, you must make sure that you run this command BEFORE any content is displayed on that page you are running it on, or else it will not work.

例如,这将不起作用:

<html>
<head>
</head>
<body>
    Hello world
</body>
<?php header("Location: mypage.php"); ?>
</html>

但这将起作用:

<?php header("Location: mypage.php"); ?>
<html>
<head>
</head>
<body>
    Hello world
</body>
</html>

基本上,只有在任何 static 内容或HTML标记从脚本中吐出之前,header命令才在​​PHP脚本中使用过才有效.

Basically, the header command will only ever work if it is used in the PHP script BEFORE any static content or even HTML tags are spit out of the script.

这篇关于发布后重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆