Home php PHP redirection to previous page

PHP redirection to previous page

Author

Date

Category

There are such scripts that process data, and then you need to return to the previous page, do through

public static function goback () {
    If (@ $ _ Server ['http_referer']! = null) {
      Header ("Location:". $ _ Server ['http_referer']);
    }
    Sys :: gohome ();
  }

But always triggers SYS :: gohome ();

What can be wrong here?


Answer 1, Authority 100%

found,

if (...) {
  Header ("Location:". $ _ Server ['http_referer']);
}
Sys :: gohome ();

It turns out after header () , execution continues, it was necessary to write via ELSE


Answer 2

Try to use after the header function ($ ST); Function Function PHP Script EXIT ();

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions