RE: [PHP] header() ???

From: Date: Thu, 14 Sep 2000 02:35:27 +0000
Subject: RE: [PHP] header() ???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16674@lists.php.net to get a copy of this message
On Thu, 14 Sep 2000, Sonia Tsui wrote: > Hi David, > > Sorry that I didn't quite get it :) > > What do you mean by any lines or spaces before that will cause an error. > > I am confused because usually when we want to display an html page, we can > just use ---include "filename.php" > why this time I need to add header(). > > ---Sonia I have no idea what your question is, then. You asked about header() which is a function to send a HTML headr - see the documentation. If you want toi include the contents of another file, then include() or require() or their cousins include_once() and require_once() may be what you need. Perhaps if you could elaborate on what you are trying to do? Incidentally, I don't do PERL so I may be missing your point because of that. > > -----Original Message----- > From: David Robley [mailto:huntsman@hermes.nisu.flinders.edu.au] > Sent: Wednesday, September 13, 2000 7:26 PM > To: Sonia Tsui; 'php-general@lists.php.net' > Subject: Re: [PHP] header() ??? > > > On Thu, 14 Sep 2000, Sonia Tsui wrote: > > When does header() need to be called? > > > > let's say: > > > > ========= > > index.php > > ========= > > <a href="<?php echo("myscript.php"); ?>...... </a> > > > > > > ========== > > myscript.php > > ========== > > > > <?php > > $cmd = "something"; > > exec("$cmd"); > > <--------- header() ???? > > include "index.php"; > > ?> > > ------------------------------------- > > I asked since for Perl CGI, this is needed: > > > > print header; > > if (open(fp,"<index.php")) { > > while (<fp>) { > > print; > > } > > } > > > > > > ---Sonia > > In a nutshell, it needs to be called before you send ANY output; even > spaces or empty lines before it will cause errors. > > -- > David Robley | WEBMASTER & Mail List Admin > RESEARCH CENTRE FOR INJURY STUDIES | > http://www.nisu.flinders.edu.au/ > AusEinet | > http://auseinet.flinders.edu.au/ > Flinders University, ADELAIDE, SOUTH AUSTRALIA -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#16674) next »