What is acceptable before a Header PHP function? -
i understand the header function supposed used before output made means things echo , print , vardump. wondering header work after functions executed. wanted insert data sql table or compare 2 variables.
much appreciated.
it's written pretty in manuel: header:
header() used send raw http header. see » http/1.1 specification more information on http headers.
remember header() must called before actual output sent, either normal html tags, blank lines in file, or php. common error read code include, or require, functions, or file access function, , have spaces or empty lines output before header() called. same problem exists when using single php/html file.
<html> <?php /* give error. note output * above, before header() call */ header('location: http://www.example.com/'); exit; ?>
this means, can run php code doesn't produce output before using header()
.
Comments
Post a Comment