Re: File retrieval

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

 



The methods suggested above would all work but if you would like to do
in one step you could use file_get_contents(). This method does not
require you to open/close the file and will automatically read the
entire file into your array.

<?php
$contents = file_get_contents("data.txt");
?>

Calvin

On Apr 3, 2005 10:23 AM, Bastien Koert <bastien_k@xxxxxxxxxxx> wrote:
> of course, there are a number of file system option syou can use depending
> on how you;d like the data to be handled, from being put into an array to
> simply storing the entire file as a string
> 
> start with file http://www.php.net/file
> or fread http://www.php.net/fread
> 
> Bastien
> >From: "Ron Piggott" <ron.php@xxxxxxxxxxxxxxxxxx>
> >Reply-To: "Ron Piggott" <ron.php@xxxxxxxxxxxxxxxxxx>
> >To: "PHP DB" <php-db@xxxxxxxxxxxxx>
> >Subject:  File retrieval
> >Date: Fri, 1 Apr 2005 22:43:17 -0500
> >
> >If I have a file named
> >
> >"data.txt"
> >
> >Is it possible to load the contents of it into a variable search as
> >
> >$contents
> >
> 
> >idealy I would like to know if I am able to do something like
> >
> >$contents = data.txt;
> >
> >Ron
> >
> >--
> >PHP Database Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> >
> 
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux