数据表备份

时间:2021-03-03 14:38:32   收藏:0   阅读:25

//备份数据表
$time = time();
Db()->execute(‘CREATE TABLE table1_‘. $time . ‘ LIKE table1‘);
Db()->execute(‘insert into table1_‘ . $time . ‘ select * from table1‘);

Db()->execute(‘CREATE TABLE table2_‘ . $time . ‘ LIKE table2‘);
Db()->execute(‘insert into table2_‘ . $time . ‘ select * from table2‘);

//清空原表
Db()->execute(‘TRUNCATE TABLE `table1`‘);

Db()->execute(‘TRUNCATE TABLE `table2`‘);

原文:https://www.cnblogs.com/CWQPHP/p/14472493.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!