<?php $dbi = new DbMysql; $dbi->dbh = 'mysql://root:mysql@127.0.0.1/coffeetest'; $map = array(); $dbi->fetchMap("SHOW TABLES", $map); $tables = array_keys($map); for($i=0; $i<count($tables); $i++){ echo($tables[$i]."\n"); $sql = "SHOW INDEX FROM ".$tables[$i]; $list = $dbi->fetchAll($sql); $indexs = array(); foreach($list as $item){ $indexs[$item['Key_name']][] = $item['Column_name']; } foreach($indexs as $key=>$val){ echo("\t".$key."\t".implode(",",$val)."\n"); } } ?>