查询Mysql所有表及其属性的Sql语句

原创
2016/08/02 12:37
阅读数 276
/**
 * Author:Alan陈保明 
 * 数据库中所有表名
 * 示例:
 * array (size=18)
'Name' => string 'mk_be_users' (length=11)
'Engine' => string 'MyISAM' (length=6)
'Version' => string '10' (length=2)
'Row_format' => string 'Dynamic' (length=7)
'Rows' => string '4' (length=1)
'Avg_row_length' => string '117' (length=3)
'Data_length' => string '468' (length=3)
'Max_data_length' => string '281474976710655' (length=15)
'Index_length' => string '2048' (length=4)
'Data_free' => string '0' (length=1)
'Auto_increment' => string '16' (length=2)
'Create_time' => string '2016-07-18 11:15:49' (length=19)
'Update_time' => string '2016-08-01 15:23:50' (length=19)
'Check_time' => null
'Collation' => string 'utf8_unicode_ci' (length=15)
'Checksum' => null
'Create_options' => string '' (length=0)
'Comment' => string '后台管理员' (length=15)
 */
public function showTables(){
    $sql = "SHOW TABLE STATUS";
    $model = new \Think\Model();
    $res = $model->query($sql);
    $this->assign('data',$res);
    $this->display('dynamic_table');
}
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部