From 06771d5cda7105f10172d927692d13f573f9cd0a Mon Sep 17 00:00:00 2001 From: dfc <952531631@qq.com> Date: Tue, 18 May 2021 18:29:48 +0800 Subject: [PATCH] update library/think/log/driver/File.php. --- library/think/log/driver/File.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/think/log/driver/File.php b/library/think/log/driver/File.php index 3f6522d1..99825631 100644 --- a/library/think/log/driver/File.php +++ b/library/think/log/driver/File.php @@ -140,6 +140,9 @@ class File try { if (count($files) > $this->config['max_files']) { + usort($files, function($a,$b){ + return filemtime($a) - filemtime($b); + }); unlink($files[0]); } } catch (\Exception $e) { -- Gitee