//执行命令获取建表的语句
$sql = "show create table user";
$db->query($sql);
//获取语句
foreach ($data as $v) {
$name = 'Create Table';
$new = $v->$a;
break;
}
//获取数据的inster 语句
$sql = "select * from user";
$data=$db->query($sql);
$insert='';
foreach ($data as $vslye){
$field=$value='';
foreach ($vslye as $v=>$k){
$field .= empty($field) ? $v : ',' . $v;
$value .= empty($value) ? "'$k'" : ",'$k'";
}
$insert.="INSERT INTO `user` ($field) VALUES ($value);";
}