PHP에서 서버 디스크 용량을 출력할때

 

사용중인 용량 / 총 용량 을 출력하고싶은데..

사용중인 량을 어떻게 출력하는지 몰라서.. 총용량 - 여유공간 을 통해 야매로 출력하게했습니다.

더 좋고 쉬운방법이 있을까요?

 

PHP 디스크 사용량 계산 출력(야매)
<?php
$dts = disk_total_space("/"); 
$dff = disk_free_space("/");
$si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
$base = 1024;
$class = min((int)log($dts , $base) , count($si_prefix) - 1);
$class2 = min((int)log($dff , $base) , count($si_prefix) - 1);
$dt = sprintf('%1.0f' , $dts / pow($base,$class)) . $si_prefix[$class];
$df = sprintf('%1.0f' , $dff / pow($base,$class2)) . $si_prefix[$class2];
$txt = sprintf($dt - $df) . $si_prefix[$class2];

echo "Disk Usage : $txt / $dt";
?>

 

 

그리고 혹시 서버 트래픽같은 정보도 출력할수있는 방법이 있을까요?

  • profile
    서버트래픽 확인하는 mod-cband 이런거 있으시면불러오실수있어요 다만 부하 쩌러요... 디스크확인하는거도 그렇구요 구지 확인할필요없으면 안하는게 좋습니다.
  • profile ?
    호곡.. 그런가요..