> 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 [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
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



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to