rap返回table表字段和comment导入到rap json

2018-06-19  本文已影响0人  天天来啦啊

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上,方便快捷,自己想要什么字段就再拼接什么字段

上一篇 下一篇

猜你喜欢

热点阅读