为什么 header() 函数不起作用


why header() function not working?

Why header("location:address");销毁会话后在 firefox 中返回此错误!:|

The connection was reset
  The connection to the server was reset while the page was loading.
  The site could be temporarily unavailable or too busy. Try again in a few
    moments.
  If you are unable to load any pages, check your computer's network
    connection.
  If your computer or network is protected by a firewall or proxy, make sure
    that Firefox is permitted to access the Web.

这是我的代码:

if ($cmd == "cwLogOut" or ! is_array ( $cwUserInfo )) {
    if ($_SESSION ['log'] == 1) {
        $msg = $cwlang ['log'] ['user'] . "[" . $cwUserInfo ["username"] . "]" . $cwlang ['log'] ['logout'];
        $asterisk->putLog ( $cwUserInfo ["username"], $cwUserInfo ["fullname"], 6, "logout", $cmd, $msg );
    }
    setcookie ( "cwUserId", $uid, time () - (3600 * 24 * 365), "/" );
    unset ( $_SESSION );
    unset ( $_SESSION ['cwUserId'] );
        session_destroy ();
    header("location:http://cas.local");
}

我使用exit(header("location:http://cas.local"));,这是工作,坦克每一个。

是的,尝试使用 ob_start() 缓存输出