利用PHP脚本辅助MySQL数据库管理1-表结构

<?php
$dbi = new DbMysql;
$dbi->dbh = 'mysql://root:[email protected]/coffeetest';

$map = array();
$dbi->fetchMap("SHOW TABLES", $map);
$tables = array_keys($map);
for($i=0; $i<count($tables); $i++){
    echo($tables[$i]."\n");
    $fields = $dbi->field($tables[$i]);
    foreach($fields as $item){
        echo("\t".$item["Field"]."\t".$item["Key"]."\t".$item["Extra"]."\n");
    }
}
?>

猜你喜欢

转载自www.cnblogs.com/coffee_cn/p/8994328.html