public function index(){
$table = '表名';
$str = '{';
$res = Db::query("select * from information_schema.columns where table_schema = '数据库名' and table_name = '$table';");
foreach ($res as $key=>$value){
$str .= "'{$value['COLUMN_NAME']}':'{$value['COLUMN_COMMENT']}',";
}
$str = trim($str,',');
$str .="}";
return $str;
}
这样都能把表里的字段和注释comment都能列出来,直接复制导入json到rap上,方便快捷,自己想要什么字段就再拼接什么字段
网友评论