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