Re: Static Pages with PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, November 19, 2006 11:41 pm, Paul Novitski wrote:
> a) You can redirect to the static page.  It can have either an .html
> extension or a .php extension.  If all it contains is HTML markup,
> that's what will be downloaded to the client.
>
> http://php.net/header
> header("Location: http://www.example.com/";);

Rant #37:

This chews up an HTTP connect, adds significant network "lag" to the
client-server interaction, and ends up reading the static file you
could have just read in your original script.

It will "work" but is, imho, a needless waste of resources and more
confusing/complicated than a simple readfile()

> b) You can read the HTML markup from a separate file and echo it to
> the client. (e.g., file(), get_file_contents())
>
> http://php.net/file_get_contents
> echo file_get_contents('example.html');

This will read the file into RAM, then into a PHP string, then echo it
out.  I *think* readfile() will, at least in later versions, be more
efficient.  Not that it really matters for performance to most users,
but, still, readfile() is probably more clear to read.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux