How can I capture a txt file's content to a variable
Moderator: General Moderators
How can I capture a txt file's content to a variable
How can I capture a txt file's content to a variable??? For ex: i have a $message variable how can I send the inside of message.txt to this variable???
http://www.php.net/manual/en/function.fopen.php
and
http://www.php.net/manual/en/function.fread.php
never used them myself so i cant explain out of the manual
and
http://www.php.net/manual/en/function.fread.php
never used them myself so i cant explain out of the manual
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Code: Select all
<?php
$fileArray = file("/path/to/file.txt");
foreach($fileArray as $eachLine) {
echo $eachLine."<br>\n";
}
?>