我的代码是:
readfile('cls_ref.csv');
fclose($fp);
$file_type = 'octet-stream';
$file_name = "cls_ref_" . date('m-d-Y H:i');
$file_ending = "csv";
header("Content-Type: application/$file_type; charset=utf-8");
header("Content-Disposition: attachment; filename=$file_name.$file_ending");
header("Pragma: no-cache");
header("Expires: 0");
header("Location:index.php");
我想在下载后重定向到index.php
但它在下载前被重定向。
我在文件末尾编写了一个代码header("Location:index.php");
,但它在之前被重定向下载文件。
有什么解决方案吗?
10 秒后的元刷新怎么样:
print "<meta http-equiv='"refresh'" content='"10;URL=index.php'">";