Re: How to include a txt file on php?

From: Date: Tue, 27 May 2003 07:03:44 +0000
Subject: Re: How to include a txt file on php?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-149058@lists.php.net to get a copy of this message
dunno. probably not, but why risk the file having malicious php code when you don't have to? granted it's unlikely, but there's no reason to use include() instead of readfile(), so why not use the more secure option? Also, there's probably a _slight_ performance penalty w/ include since it has to parse the file. On Monday 26 May 2003 10:52 pm, you wrote: > Is there any reason why include() couldn't be used? > > Justin > > on 27/05/03 5:51 PM, Miranda, Joel Louie M (jmiranda@pd.state.gov) wrote: > > Its working now, I've tried a different syntax. > > > > Include > > > > > > Thanks, > > Louie > > > > -----Original Message----- > > From: Evan Nemerson [mailto:evan@coeus-group.com] > > Sent: Tuesday, May 27, 2003 2:34 PM > > To: Miranda, Joel Louie M > > Cc: php-general@lists.php.net > > Subject: Re: [PHP] How to include a txt file on php? > > > > > > file returns an arrray. either do implode("", file()); or use > > file_get_contents() instead > > > > the readfile() Rasmus mentioned looks like this: > > <?php readfile('/dynamic/ree_menu.wbc'); ?> > > and will output directly to the browser. > > > > Look at: > > php.net/readfile > > php.net/implode > > php.net/file > > php.net/file_get_contents > > > > On Monday 26 May 2003 11:29 pm, Miranda, Joel Louie M wrote: > >> Rasmus, > >> > >> <?php $readfile = file("/dynamic/ree_menu.wbc"); print $readfile; ?> > >> > >> I've tried this approach, But it does not work, any Ideas? > >> > >> Thanks, > >> Louie > >> > >> -----Original Message----- > >> From: Rasmus Lerdorf [mailto:rasmus@lerdorf.com] > >> Sent: Tuesday, May 27, 2003 11:30 AM > >> To: Miranda, Joel Louie M > >> Cc: 'php-general@lists.php.net' > >> Subject: Re: [PHP] How to include a txt file on php? > >> > >> On Tue, 27 May 2003, Miranda, Joel Louie M wrote: > >>> Im doing some html coding's. The pages are quite huge but has the > >>> same contents. I wonder how do you include a text file on php? > >> > >> readfile() -- Prisons are built with stones of Law, Brothels with bricks of Religion. -William Blake

« previous php.general (#149058) next »