log data into file php

Solutions on MaxInterview for log data into file php by the best coders in the world

showing results for - "log data into file php"
Pietro
21 Jun 2016
1//Something to write to txt log
2$log  = "User: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL.
3        "Attempt: ".($result[0]['success']=='1'?'Success':'Failed').PHP_EOL.
4        "User: ".$username.PHP_EOL.
5        "-------------------------".PHP_EOL;
6//Save string to log, use FILE_APPEND to append.
7file_put_contents('./log_'.date("j.n.Y").'.log', $log, FILE_APPEND);
8