Sophie

Sophie

distrib > Mandriva > 9.1 > ppc > by-pkgid > a34ed6838d4b29d38abd504392a4a797 > files > 828

php-manual-es-4.3.0-2mdk.noarch.rpm

<HTML
><HEAD
><TITLE
>headers_sent</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="Manual de PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="Funciones HTTP"
HREF="ref.http.html"><LINK
REL="PREVIOUS"
TITLE="header"
HREF="function.header.html"><LINK
REL="NEXT"
TITLE="setcookie"
HREF="function.setcookie.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=ISO-8859-1"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Manual de PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.header.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.setcookie.html"
ACCESSKEY="N"
>Siguiente</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.headers-sent"
></A
>headers_sent</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN23466"
></A
><P
>    (PHP 3&#62;= 3.0.8, PHP 4 )</P
>headers_sent&nbsp;--&nbsp;Checks if or where headers have been sent</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN23469"
></A
><H2
>Description</H2
>boolean <B
CLASS="methodname"
>headers_sent</B
> ( [string &#38;file [, int &#38;line]])<BR
></BR
><P
>&#13;     <B
CLASS="function"
>headers_sent()</B
> will return <TT
CLASS="constant"
><B
>FALSE</B
></TT
> if no HTTP headers
     have already been sent or <TT
CLASS="constant"
><B
>TRUE</B
></TT
> otherwise. If the optional
     <TT
CLASS="parameter"
><I
>file</I
></TT
> and <TT
CLASS="parameter"
><I
>line</I
></TT
> parameters
     are set, <B
CLASS="function"
>headers_sent()</B
> will put the php source
     file name and line number where output started in the <TT
CLASS="parameter"
><I
>file</I
></TT
>
     and <TT
CLASS="parameter"
><I
>line</I
></TT
> variables.
    </P
><P
>&#13;     You can't add any more header lines using the <A
HREF="function.header.html"
><B
CLASS="function"
>header()</B
></A
> 
     function once the header block has already been sent. Using this function 
     you can at least prevent getting HTTP header related error messages.
     Another option is to use <A
HREF="ref.outcontrol.html"
>Output Buffering</A
>.
    </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>New parameters: </B
>
      The optional <TT
CLASS="parameter"
><I
>file</I
></TT
> and <TT
CLASS="parameter"
><I
>line</I
></TT
> 
      parameters where added in PHP 4.3.0.
     </P
></BLOCKQUOTE
></DIV
><P
>&#13;     <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN23498"
></A
><P
><B
>Ejemplo 1. Examples using <B
CLASS="function"
>headers_sent()</B
></B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="php"
>&#60;?php

// If no headers are sent, send one
if (!headers_sent()) {
    header ('Location: http://www.example.com/');
    exit;
}
  
// An example using the optional file and line parameters, as of PHP 4.3.0
// Note that $filename and $linenum are passed in for later use.
// Do not assign them values beforehand.
if (!headers_sent($filename, $linenum)) {
    header ('Location: http://www.example.com/');
    exit;

// You would most likely trigger an error here.
} else {

    print "Headers already sent in $filename on line $linenum\n" .
          "Cannot redirect, for now please click this &#60;a " .
          "href=\"http://www.example.com\"&#62;link&#60;/a&#62; instead\n";
    exit;
}

?&#62;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
    </P
><P
>&#13;     See also <A
HREF="function.ob-start.html"
><B
CLASS="function"
>ob_start()</B
></A
>, <A
HREF="function.trigger-error.html"
><B
CLASS="function"
>trigger_error()</B
></A
>, 
     and <A
HREF="function.header.html"
><B
CLASS="function"
>header()</B
></A
> for a more detailed discussion of the 
     matters involved.
    </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.header.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Inicio</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.setcookie.html"
ACCESSKEY="N"
>Siguiente</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>header</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.http.html"
ACCESSKEY="U"
>Subir</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>setcookie</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>