我只有一个用于多种语言的.php(root/process.php
)文件
root/en/command.htm
root/fr/command.htm
root/ru/command.htm
等等。但是,对于每个命令,我在同一文件夹中有一个thankYou.htm
:
root/en/thankYou.htm
root/fr/thankYou.htm
root/ru/thankYou.htm
如何在process.php
?
// redirect to a thank you page
header("Location: " .$_SERVER['HTTP_REFERRER']. "\thankYou.htm");
这不起作用:错误404.通常,如果引用者是root/ru/command.htm
,例如,那么php应该将用户发送到root/ru/thankYou.htm
等。
答案 0 :(得分:2)
在HTTP中,它拼写错误为“referer”,因此您需要$_SERVER['HTTP_REFERER']
。
答案 1 :(得分:2)
尝试斜杠而不是反斜杠:
header("Location: " .$_SERVER['HTTP_REFERER']. "/thankYou.htm");