ini_set('display_errors', true); error_reporting(E_ALL); require 'lib.php'; $config = (require 'config.php'); $host_index = _get('connection', 0); $connections = $config['connections']; $host_info = $connections[$host_index]; DbWrapper::config($host_info); $dbname_index = _get('dbname', 0); if (isset($host_info['dbnames']) && $host_info['dbnames'] !== true) { $dbnames = $host_info['dbnames']; } else { $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'); // 获得表的注释,并将列表存在数组里