开发者

Obtain the referrer path in PHP

I have a only one .php (root/process.php) file for multiple languages

root/en/command.htm 
root/fr/command.htm 
root/ru/command.htm 

and so one. However, for each of commands I have a thankYou.htm in the same folder:

root/en/thank开发者_开发百科You.htm 
root/fr/thankYou.htm 
root/ru/thankYou.htm 

How do I redirect the page after processing it in the process.php?

// redirect to a thank you page
header("Location: " .$_SERVER['HTTP_REFERRER']. "\thankYou.htm");

this does not work: Error 404. Normally, if the referrer is root/ru/command.htm by e.g., so the php should sent user to root/ru/thankYou.htm etc.


Try a slash instead a backslash:

header("Location: " .$_SERVER['HTTP_REFERER']. "/thankYou.htm");


In HTTP it's misspelled as "referer", so you want $_SERVER['HTTP_REFERER'].

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜