PHP/HTML/headers sent

Материал из Web эксперт
Перейти к: навигация, поиск

headers_sent( ) function returns true if your HTTP headers have been sent or false otherwise.

 
<?
    header("Expires: Sat, 22 Dec 1979 05:30:00 GMT");
    echo "This is some text for output.<br />";
    if (!headers_sent($filename, $linenum)) {
            header("Location: www.yoursite.ru");
            exit;
    } else {
            echo "Headers already sent in $filename on line $linenum.";
            exit;
    }
?>