-1
$harddrive_out = format_bytes(kb2bytes($harddrive[2])).'<small> / '.format_bytes(kb2bytes($harddrive[1])).' <small>('.calculate_percentage(kb2bytes($harddrive[2]), kb2bytes($harddrive[1])).'% Free)</small></small>'; 

この行は私にそのエラーを与えます

私はhttp://www.installgentoo.net/からこのコードを入手 しました。私はWindowsを使用していますが、おそらくLinuxを使用しています

これがWindowsの問題である場合、WindowsとLinuxで機能するものを作成するにはどうすればよいですか(これは常に正しいHDDを取得するdisk_total_space("C:")ため、すべてのWebサーバーがCドライブにあるとは限らないため、次のようなものは使用しません.

私が使用している方法が必要な場合

function format_bytes($bytes){ 
    if ($bytes < 1024){ return $bytes; } 
    else if ($bytes < 1048576){ return round($bytes / 1024, 2).'KB'; } 
    else if ($bytes < 1073741824){ return round($bytes / 1048576, 2).'MB'; } 
    else if ($bytes < 1099511627776){ return round($bytes / 1073741824, 2).'GB'; } 
    else{ return round($bytes / 1099511627776, 2).'TB'; } 
} 


    function kb2bytes($kb){ 
    return round($kb * 1024, 2); 
} 

function calculate_percentage($used, $total){ 
    return @round(100 - $used / $total * 100, 2); 
4

1 に答える 1