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

时间:2013-10-19 07:34:15

标签: php session

为什么标题("位置:地址");在毁灭会议之后 在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");
}

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分:0)

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