数据表备份

//备份数据表
$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