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






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.com");
            exit;
    } else {
            echo "Headers already sent in $filename on line $linenum.";
            exit;
    }
?>
  
  








Related examples in the same category