Re: ? about PHP includes

From: Date: Fri, 03 Aug 2001 04:41:48 +0000
Subject: Re: ? about PHP includes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-61074@lists.php.net to get a copy of this message
> I just discovered PHP this week. I'm reading about include statements. If I > have a text file 2000 characters in length that I want to include, I would > do this to include to whole file: > > <?php > include ("file.txt"); > ?> http://php.net/fopen http://php.net/fread <?php $path = "file.txt"; $file = fopen($path, 'r') or die("Could not open $path. Try full path or something."); $data = fread($file, 250); echo $data; ?> Note that include not only includes a text file, but also executes any <?php ?> tags within it. So it's not ideal for sucking in a whole plain text file anyway. Check out http://php.net/readfile -- WARNING richard@zend.com address is an endangered species -- Use ceo@l-i-e.com Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#61074) next »