'.'.PUBILC_PATH.'/backup/data/', //数据库备份路径 'part' => 20971520, //数据库备份卷大小 'compress' => 1, //数据库备份文件是否启用压缩 0不压缩 1 压缩 'level' => 5, ); $this->DB = new Backup($config); } /** * 数据类表列表 */ public function index(){ return $this->fetch(); } /** * 获取数据库表 * @param Request|null $request */ public function tablelist(Request $request = null) { $db= $this->DB; return Json::result(0,'sucess',$db->dataList(),count($db->dataList())); } /** * 查看表结构 * @param Request|null $request */ public function seetable(Request $request = null) { $database = config("database.database"); $tablename = $request->param('tablename'); $res = Db::query("select * from information_schema.columns where table_name = '".$tablename."' and table_schema = '".$database."'" ); $html = ''; $html .= '
| 字段名 | 数据类型 | 默认值 | 允许非空 | 自动递增 | 备注 | ' . $f['COLUMN_NAME'] . ' | '; $html .= '' . $f['COLUMN_TYPE'] . ' | '; $html .= '' . $f['COLUMN_DEFAULT'] . ' | '; $html .= '' . $f['IS_NULLABLE'] . ' | '; $html .= '' . ($f['EXTRA'] == 'auto_increment'?'是':' ') . ' | '; $html .= '' . $f['COLUMN_COMMENT'] . ' | '; $html .= ''; } $html .= '
|---|
总共:' . count($res) . '个字段
'; $html .= '