I am making log file in php I am not able to read from that text file, can you tell me how can I read from the text file using php?
I am making log file in php I am not able to read from that text file, can you tell me how can I read from the text file using php?
You can ready file using fread, you can refer following code for reading a file
ThanksPHP Code:$myFile = "File.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, 5);
fclose($fh);
echo $theData;
harry (07-25-2009)
You can use fopen, fread to read from the file and you can print whole file on the screen or convert it to mysql
Code:$msg=""; $handle=fopen("file.txt","r"); while(!feof($handle)) $msg = $msg . fgets($handle,4096); fclose($handle); echo $msg;
PHP have file_get_contents function, which returns file content as string.
$str = file_get_contnets("file.txt")
Bookmarks