MysqL_select_db("yourdatabase"); $q = MysqL_query("SHOW TABLE STATUS"); $size = 0; while($row = MysqL_fetch_array($q)) { $size += $row["Data_length"] + $row["Index_length"]; }
然后转换为兆字节:
$decimals = 2; $mbytes = number_format($size/(1024*1024),$decimals);