我目前正在尝试做一个日志文件,我想在其中插入一个倒序年表样式(最新的项目将被放在所有现有文本的列表之上,以前的现有项目将被推到下面),想想它像Facebook页面,在那里如果你访问一个个人资料页面,你可以看到他的所有帖子最新的->最旧,而不是目前我所拥有的是,最早的->最新。这是我到目前为止的代码;
$date = date("d-m-Y H:i:s");
$file = 'logfile.txt';
if (file_exists($file)) {
$current = file_get_contents($file);
$current .= PHP_EOL.$date;
file_put_contents($file, $current);
} else {
file_put_contents($file, $date);
}
https://stackoverflow.com/questions/41358231
复制相似问题