What's the easiest way to redirect to the previous page with PHP?
问题 I'm using a form to submit some post information to a PHP script. After the script finishes, I want it to redirect right back to the page the user came from. Right now I'm just using header() with a static URL. I've found a ton of very conflicting information about this around the internet, so I'm wondering what StackOverflow thinks. 回答1: Use HTTP_REFERER: header('Location: ' . $_SERVER['HTTP_REFERER']); 回答2: access the $_SERVER['HTTP_REFERER'] variable and redirect to this. Should do the