Alternative to “header” for re-directs in PHP

前端 未结 8 1623
旧时难觅i
旧时难觅i 2020-12-05 06:16

I am working on a project and I am required to run my program on someone else\'s webserver. It is a pretty simple login page that I am having the problem with. The program

8条回答
  •  Happy的楠姐
    2020-12-05 06:27

    I use this function for redirect...

    Which works in all situations..even if headers are already sent..or even javascript is disabled..

    function redirect($url)
    {
        if (!headers_sent())
        {    
            header('Location: '.$url);
            exit;
            }
        else
            {  
            echo '';
            echo ''; exit;
        }
    }
    

提交回复
热议问题