dongzantai7570 2010-05-16 17:39 采纳率: 0%
浏览 123
已采纳

PHP header()&exit()会在重定向之前安全地终止脚本吗?

Is the following a secure way of protecting a user only area?

if(!isset($_SESSION['username'])){redirect(SITE_ROOT . 'st_pages/login/');}

using:

function redirect($url)
    {
        header('Location: ' . $url);
        exit('<a href="' . $url . '">Redirecting you to: ' . $url . '</a>');
    }
  • 写回答

3条回答 默认 最新

  • dongluxin2452 2010-05-16 17:41
    关注

    yes it is secure

    though header() do not terminate anything, but exit() indeed terminate a script. that's the only purpose of this function

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?