[SATLUG] php: require, fopen

Steele Kennett steele at denimgroup.com
Mon Aug 2 16:05:10 CDT 2004


For static includes I recommend using require_once() for performance 
reasons.

Steele Kennett
Lead Developer
Denim Group, Ltd.
3463 Magic Drive, Suite 315
San Antonio, TX 78229

(210) 572-4400
(210) 582-5810 fax


N. David Guarneri wrote:
> It seems that there are many ways to embed/include a file in php:
> fpassthru(), file(), fopen(), include(), require(), virtual(),
> file_get_contents().  I am putting require(heading.txt) at the 
> top of every html page to include header info such as stylesheet,
> menu, etc.  It is, however, putting a "1" in my page which I take
> out by using html comment tags.  Not a problem, but I am wondering
> if this will provide consistent behavior.
> 
> Is require the best thing to use?  What about fopen()?  Do
> the files go into a cache, the way .css files do?
> Has anyone had experience with this, and if so, what are your
> recommendations?  Thanks.


More information about the Satlug mailing list