我需要通过添加文件来处理文件,然后将其另存为单独的每周文件。
每月进行一次很容易,我的工作如下:
// Set variables
$month = date('m');
$year = date('Y');
// Load previous file content
$newreportfile = file_get_contents('/var/www/html/reports/' . $year . "_" . $month . "_report.csv");
// Add new content
$file_to_write = $newreportfile . $report_log;
// Write file back
file_put_contents('/var/www/html/reports/' . $year . "_" . $month . "_report.csv",$file_to_write);
将其全部保存在月度文件中效果很好,但是我该如何将其保存为每周格式,特别是在一周中的特定日期特定时间(星期日23:59:59)中断文件)?
任何关于最佳方法的指导都将受到赞赏。
谢谢。