Many times we need to create logs in our Web Applications to track any certain Errors or Response. We just need to put a bunch of code where you want to Create a log. In this post you will learn how to create logs using Php Code.
1 2 3 4 5 6 7 | <?php $log = "User: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL. "amount: ".$amount.PHP_EOL. "user_id: ".$user_id.PHP_EOL. "-------------------------".PHP_EOL; file_put_contents('log_'.date("d-m-Y").'.txt', $log, FILE_APPEND); ?> |
This code will check for the filename. […]