I want to log the execution of a php
file on a .txt
file.
I want the file to look like this with serial number:
1, (time)
2, (time)
3, (time)
. . . . .
. . . . .
where (time) is the time of execution of the php
file.
How to add the serial number to each line and how to put each entry on next line?
$today = date("Y-m-d H:i:s");
$file = fopen("log.txt","a+");
fwrite($file,$today);
fclose($file);
chmod
.In your script, paste the following code:
$fh = fopen("log.txt","a+");
fwrite($fh, date("Y-m-d g:i a")."\r\n");
fclose($fh);
http://php.net/manual/en/function.fopen.php
http://php.net/manual/en/function.fwrite.php