MySQL数据的自动或定期备份
$sql = 'SELECT * FROM my_table ORDER id DESC';$result = mysqli_query( $connect, $sql ); if( mysqli_num_rows( $result ) > 0){ $output=fopen('/tmp/dumpfile.csv','w+'); /* loop through recordset and add that to the file */ while( $row = mysqli_fetch_array( $result ) ) { fputcsv( $output, $row, ',', '"'); } fclose( $output );}
mysqldump
exec