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

前端 未结 6 2060
余生分开走
余生分开走 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:30

    Just a little addition: I believe it's a common and known thing to add exit; after the header function in case we don't want the rest of the code to load or execute...

    header('Location: ' . $_SERVER['HTTP_REFERER']);
    exit;
    

提交回复
热议问题