$dbnames = DbWrapper::getDataBases(); } $dbname = $dbnames[$dbname_index]; DbWrapper::config('dbname', $dbname); if ($table = _get('t')) { $type = _get('type'); $create = DbWrapper::getCreate($table); $fields = DbWrapper::getFields($table); $tpl = 'index-table'; } else { // 获取表的列表,支持关键字搜索 $t = _get('table_like'); if ($t) { $stmt = DbWrapper::exec("SHOW FULL TABLES LIKE ?", array("%{$t}%")); } else { $stmt = DbWrapper::exec("SHOW FULL TABLES"); } $f = _get('field_like'); // 获得表的注释,并将列表存在数组里 $tables = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $table = $row[0]; $arr = explode(' ', $row[1]); $type = end($arr); if (preg_match('/#/', $table)) { continue; } $create = DbWrapper::getCreate($table); $rs = preg_match("/ENGINE=.+COMMENT='(.+)'\$/", $create, $matches); $comment = $rs ? $matches[1] : ''; $table_info = compact('table', 'type', 'comment', 'create');