0
我正在从事php excel导出。在这里,我正面临一些问题,比如有大量的数据将近8000条记录。数据完美地放置在单元中。我的问题是获取记录之前csv被下载
在3000条记录本身csv被下载。我怎样才能解决这个问题 ?
有没有更多的3000到8000我该怎么做?
示例代码
<?php
// Connection
$tamdsreport_billing_qry = db_query($_SESSION['tamdsreport_billing_qry']);
while($result_tamdsreport_billing_qry = db_fetch_array($tamdsreport_billing_qry)){
$datacenter_param = $result_tamdsreport_billing_qry['datacenter'];
$cid_param = $result_tamdsreport_billing_qry['cid'];
$rid_param = $result_tamdsreport_billing_qry['rid'];
$datastore_name_param = $result_tamdsreport_billing_qry['datastore_name'];
$cloud_type_param = $result_tamdsreport_billing_qry['cloud_type'];
$storage_type_param = $result_tamdsreport_billing_qry['storage_type'];
$avg_capacity_gb_param = $result_tamdsreport_billing_qry['avg_capacity_gb'];
$avg_free_space_gb_param = $result_tamdsreport_billing_qry['avg_free_space_gb'];
$avg_space_consumed_gb_param = $result_tamdsreport_billing_qry['avg_space_consumed_gb'];
$gb_used_param = $result_tamdsreport_billing_qry['gb_used'];
$start_date = $result_tamdsreport_billing_qry['start_date'];
$end_date = $result_tamdsreport_billing_qry['end_date'];
$html3[] = "<tr><td>$datacenter_param</td><td>$start_date</td><td>$end_date</td><td>$cid_param</td><td>$rid_param</td><td>$datastore_name_param</td><td>$cloud_type_param</td><td>$storage_type_param</td><td>$avg_capacity_gb_param</td><td>$avg_free_space_gb_param</td><td>$avg_space_consumed_gb_param</td><td>$gb_used_param</td></tr>";
}
$html = "<table><tr><td> </td><tr><td><h3>Storage Usage for A0CA </h3> </td></tr><tr bgcolor='#445fea'><td>Data Center</td><td>Report Start Date</td><td>Report End Date</td><td>CID</td><td>RID</td><td>Data Store Name</td><td>Cloud Type</td><td>Storage Type</td><td>Avg capacity GB</td><td>Avg free space GB</td><td>Avg space consume GB</td><td>GB Used</td></tr>".implode("\r\n", $html3). "</table>";
$fileName = 'tamdrp_billing_export_US.xls';
}
header('Content-Type: application/octet-stream');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header("Content-Disposition: attachment; filename=$fileName");
echo $html;
exit;
?>
您是否确定生成了8000条记录?我宁愿将这些记录保存到一个临时文件中,并用'readfile($ tempfile)'标记这个头文件。 –