我使用新标记<a download="test.csv" href="exp.php?type=5">
而我的exp.php
需要一些时间来计算结果。我希望文件能够显示海峡,并在加载/生成时添加数据。
我尝试了这些,但他们不工作:
// Required
header('Content-Type: text/csv; charset=utf-8');
header('Content-Disposition: attachment;');
// Experimental
header('Content-Transfer-Encoding: binary');
header('Content-Type: application/octet-stream');
header('Pragma: public');
header('Connection: close');
// ... exp.php
$output = fopen('php://output', 'w');
fputcsv($output, $example); // Runs ~ 100-2000 times (10-5000 seconds)