首页 > 解决方案 > PHP header(Location:...) not working

问题描述

Working on a sign up/log in form and for some reason header() redirect doesn't seem to be working.

if (password_verify($_POST['password'], $row['password'])){
    header("Location: account.php");
    if ($_POST['stayLoggedIn'] == 1){
              setcookie("id", $row["id"], time() + 60*60*24*365);
             }
    }

I have checked that the code works as intended by swapping the header() with an echo and print_r to check that the fields were working and they return the expected information.

标签: php

解决方案


推荐阅读