I have drafted a paragraph of text and each mailing log will generate a .log file
This is the code I refer to 1 user guide
function wh_log($log)
{
$log_filename = "log";
if (!file_exists($log_filename))
{
// create directory/folder uploads.
mkdir($log_filename, 0777, true);
}
$log_file_data = $log_filename.'/log_' . date('d-M-Y') . '.log';
file_put_contents($log_file_data, $log . "\n", FILE_APPEND);
}
The default data will be displayed every time overwriting
1
2
3
4
5
But I want the latest data to always be on the top
5
4
3
2
1
Please help me. Thanks all