开发者

Obtain the referrer path in PHP

开发者 https://www.devze.com 2022-12-18 10:37 出处:网络
I have a only one .php (root/process.php) file for multiple languages root/en/command.htm root/fr/command.htm

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

精彩评论

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

关注公众号