Kashiwagi,1000 Hidaka,500 Ohira,300</pre> <h2>読込結果</h2> <a href="report.php">reports.csv</a> <table class="table"> <tr> <th>社員数</th> <th>売上合計</th> <th>売上平均</th> </tr> <tr> <td><?php echo $hmodel->staff_num(); ?> </td> <td><?php echo $hmodel->sales_sum(); ?> </td> <td><?php echo $hmodel->sales_ave(); ?> </td> </tr> </table> </div> </body> </html>
<?php require "homework5_model.php"; $hmodel = new Homework5Model(); $csv = "社員数,売上合計,売上平均\n"; $csv .= $hmodel->staff_num() . "," . $hmodel->sales_sum() . "," . $hmodel->sales_ave(); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=report.csv"); echo $csv;