下载表格到单独的工作表

<?php require "connection.php"; //error_reporting(E_ALL); //ini_set('display_errors',1); $date= date("m/d/Y"); ?> <!DOCTYPE HTML> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css"> <style> .container{ margin-top: 50px; } table, th,td { border: 1px solid; } .panel-primary{ width:200%; } .table{ width: auto !important; } .panel-danger{ width: 60%; } .hbp{ width: 100% !important; } .rsvp{ width: 50% !important; } </style> </head> <body> <title>Admin Reports</title> <div class="container"> <h1 style= "padding-bottom:10px;">Daily Reports</h1> <!-- BEGIN COLD --> <div class="row"> <div class="panel-primary"> <div class="panel-heading"> <h3 class="panel-title">Cold</h3> </div> <table class="table table-hover" id="dev-table"> <thead> <tr> <?php $query = mysqli_query($conn,"SHOW columns FROM `call`"); // Loop over all result rows while($row = mysqli_fetch_array($query)) { if($row["Field"] == 'id') { continue; } echo '<th>'; echo $row["Field"]; echo '</th>'; } ?> </tr> </thead> <tbody> <?php $query2= "SELECT * from `call` WHERE `Date` = '$date'"; $result= mysqli_query($conn, $query2); while($row = mysqli_fetch_assoc($result)) { echo '<tr>'; foreach($row as $fieldname => $values) { if($fieldname == 'id') { continue; } else { echo '<td>'; echo $values; echo '</td>'; } } echo '</tr>'; } ?> </tbody> </table> <!-- END COLD --> <!-- BEGIN COMM --> <div class="panel-info"> <div class="panel-heading"> <h3 class="panel-title">Com</h3> </div> <table class="table table-hover" id="dev-table"> <thead> <tr> <?php $query = mysqli_query($conn,"SHOW columns FROM `com`"); // Loop over all result rows while($row = mysqli_fetch_array($query)) { if($row["Field"] == 'id') { continue; } echo '<th>'; echo $row["Field"]; echo '</th>'; } ?> </tr> </thead> <tbody> <?php $query2= "SELECT * from `com` WHERE `Date` = '$date'"; $result= mysqli_query($conn, $query2); while($row = mysqli_fetch_assoc($result)) { echo '<tr>'; foreach($row as $fieldname => $values) { if($fieldname == 'id') { continue; } else { echo '<td>'; echo $values; echo '</td>'; } } echo '</tr>'; } ?> </tbody> </table> <!-- END COM --> 

我想,而不是他们显示,当我点击“生成报告”一个excel文件下载每张表在单独的工作表? 这可能吗? 我读了一下,但似乎无法弄清楚它是如何完成的。