Question : how to create a logfile in php?
Answered by : lawrence-cherone
<?php
//Something to write to txt log
$log = "User: ".$_SERVER['REMOTE_ADDR'].' - '.date("F j, Y, g:i a").PHP_EOL. "Attempt: ".($result[0]['success']=='1'?'Success':'Failed').PHP_EOL. "User: ".$username.PHP_EOL. "-------------------------".PHP_EOL;
//Save string to log, use FILE_APPEND to append.
file_put_contents('./log_'.date("j.n.Y").'.log', $log, FILE_APPEND);
Source : https://stackoverflow.com/questions/19898688/how-to-create-a-logfile-in-php/19898993#19898993 | Last Update : Fri, 04 Sep 20
Question : log php
Answered by : average-ape-8wazfnfygvi2
<?php
function console_log($output, $with_script_tags = true) { $js_code = 'console.log(' . json_encode($output, JSON_HEX_TAG) .
');'; if ($with_script_tags) { $js_code = '<script>' . $js_code . '</script>'; } echo $js_code;
}
Source : https://stackify.com/how-to-log-to-console-in-php/ | Last Update : Wed, 19 Aug 20