diff --git a/library/think/log/driver/File.php b/library/think/log/driver/File.php index 3f6522d1a39ba18168213dbf49eac70b650f58da..998256314c00e6ea107285fabbf900868a2bea67 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) {