This is a discussion on The best method to send a large file to client? within the PHP Language forums, part of the PHP Programming Forums category; Arjen wrote: > howachen@gmail.com schreef: >> I have many text file with 1 to 2MB in size &...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Arjen wrote:
> howachen@gmail.com schreef: >> I have many text file with 1 to 2MB in size >> >> currently, i use the method: >> >> echo file_get_contents( $file_path ); >> >> >> are there any better method? >> >> thanks. > > Yup .. stream the file. > > file($file_path); You'll run out of memory very quickly using file(...) or file_get_contents(...) on big files. C. |
|
|||
|
NC 寫道: > On Oct 5, 12:17 am, howac...@gmail.com wrote: > > > > I have many text file with 1 to 2MB in size > > > > currently, i use the method: > > > > echo file_get_contents( $file_path ); > > > > are there any better method? > > Yes. Use readfile(): > > http://www.php.net/readfile > > Cheers, > NC thanks all... seems readfile() is the best method |
|
|||
|
NC wrote:
> On Oct 5, 12:17 am, howac...@gmail.com wrote: > > > > I have many text file with 1 to 2MB in size > > > > currently, i use the method: > > > > echo file_get_contents( $file_path ); > > > > are there any better method? > > Yes. Use readfile(): > > http://www.php.net/readfile When I read the responses in this thread, I was wondering what happened to c.l.php (obvious shortage of PHP saints). Fortunately, still Nikolai Chuvakhin is hacking PHP...:-) -- <?php echo 'Just another PHP saint'; ?> Email: rrjanbiah-at-Y!com Blog: http://rajeshanbiah.blogspot.com/ |