您好,欢迎访问一九零五行业门户网

php计算整个mysql数据库大小的方法,php计算mysql数据库_PHP教程

php计算整个mysql数据库大小的方法,php计算mysql数据库本文实例讲述了php计算整个mysql数据库大小的方法。分享给大家供大家参考。具体如下:
这里用mb,kb或者gb的格式返回计算结果。
function calcfulldatabasesize($database, $db) { $tables = mysql_list_tables($database, $db); if (!$tables) { return -1; } $table_count = mysql_num_rows($tables); $size = 0; for ($i=0; $i 1024; $i++) { $size /= 1024; } return round($size, 2).$units[$i];}/*** example:*/// open mysql connection:$handle = mysql_connect('localhost', 'user', 'password'); if (!$handle) { die('connection failed!'); }// get the size of all tables in this database:print calcfulldatabasesize('customer1234', $handle);// --> returns something like: 484.2 kb// close connection:mysql_close($handle);
希望本文所述对大家的php程序设计有所帮助。
http://www.bkjia.com/phpjc/1019453.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/1019453.htmltecharticlephp计算整个mysql数据库大小的方法,php计算mysql数据库 本文实例讲述了php计算整个mysql数据库大小的方法。分享给大家供大家参考。具体如下...
其它类似信息

推荐信息