Letters
Moderator: General Moderators
-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
Letters
how would i make a script that prints the whole file? i have tried the fread and fgets but when i try to print it, it only prints out one letter.
Code: Select all
$filename="test.txt";
$fd = fopen($filename, "rb");
while($line = fgets($fd, 1024))
print($line);Code: Select all
$filename="test.txt";
$lines = file($filename);
foreach($lines as $line)
print($line);Code: Select all
$filename="test.txt";
while($data = fread($fd, 1024))
print($data);Code: Select all
$filename="test.txt";
readfile($filename);-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
int unlink ( string filename) and you (/the script) need(s) write and/or modify permissions.
assuming apache on linux:
What are the owner/group/other permissions on that file.
and what effective uid/gid is your script running under?
assuming apache on linux:
What are the owner/group/other permissions on that file.
and what effective uid/gid is your script running under?
Last edited by volka on Mon Aug 19, 2002 9:58 pm, edited 1 time in total.
-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
Code: Select all
$filename="test.txt";
$fd = fopen($filename, "rb") or die('failed to open $filename");
while($line = fgets($fd, 1024))
print($line);
fclose($fd);-
Silver_Eclipse
- Forum Commoner
- Posts: 61
- Joined: Sun Aug 18, 2002 7:26 pm
here's a chunk of my code:
Code: Select all
while(list($array) = each($file)){
if ($array > $a and $array < $b){
fputs ($fe, $fileї$array], 100000);
fclose ($fe);
}