From f0a88b3c96b236675761db7d28b9e43c4b8e4872 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Tue, 11 Jan 2022 08:06:43 +0800 Subject: [PATCH] DiskSpace.php --- php/DiskSpace.php | 97 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 php/DiskSpace.php diff --git a/php/DiskSpace.php b/php/DiskSpace.php new file mode 100644 index 0000000..f477c47 --- /dev/null +++ b/php/DiskSpace.php @@ -0,0 +1,97 @@ + self::format($free_bytes), + 'free_bytes' => $free_bytes, + 'occupied' => self::format($occ_bytes), + 'occupied_bytes' => $occ_bytes, + 'total' => self::format($total_bytes), + 'total_bytes' => $total_bytes, + ]; + } +} + +// Использование: +$path = $_SERVER['DOCUMENT_ROOT']; +$info = DiskSpace::get($path); +print_r($info); + +/* Результат: +Array +( + [free] => 67.17 Гб + [free_bytes] => 72120483840 + [occupied] => 1.39 Тб + [occupied_bytes] => 1528753938432 + [total] => 1.46 Тб + [total_bytes] => 1600874422272 +) +*/ \ No newline at end of file