Re: Include vs. Header
| From: | Matt McClanahan | Date: | Fri, 06 Oct 2000 23:55:59 +0000 |
| Subject: | Re: Include vs. Header | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19007@lists.php.net to get a copy of this message | ||
On Fri, 6 Oct 2000, Eugene Yi (InfoSpace Inc) wrote:
> Hi, guys!
> I'd wanna ask you a trivial question and I don't have a firm idea even after
> referencing to the php.net's doc. I basically want to know the differences
> and usages of include() and header() (and require()). When I was working
> with PHP 2.x, I always (and only) used include() & exit() combi to move on
> to the next page. It feels like I have some limitation when doing so in PHP
> 4. Is that true especially when I introduce the cookie function, or am I
> just dreaming?
PHP still uses include and require to include content in a page, just as
you were doing in your example. Header() is used for a different purpose,
to send HTTP Header information. One of those headers, Location, simply
redirects the browser to a new location. You don't return from it,
because it's sent to the browser before any normal content.
As a side note, exit() isn't really necessary in the include files.
Matt