Back to previous page with header( “Location: ” ); in PHP

前端 未结 6 2031
余生分开走
余生分开走 2020-11-28 02:46

The title of this question kind of explains my question. How do I redirect the PHP page visitor back to their previous page with the header( \"Location: URL of previou

6条回答
  •  时光取名叫无心
    2020-11-28 03:24

    Just try this in Javascript:

     $previous = "javascript:history.go(-1)";
    

    Or you can try it in PHP:

    if(isset($_SERVER['HTTP_REFERER'])) {
        $previous = $_SERVER['HTTP_REFERER'];
    }
    

提交回复
热议问题