PHP生成下载文件,然后重定向我有一个PHP应用程序,它创建一个CSV文件,该文件被迫使用头下载。下面是代码的相关部分:header('Content-Type: application/csv'); header("Content-length: " . filesize($NewFile)); header('Content-Disposition:
attachment; filename="' . $FileName . '"'); echo $content;exit();我想做的是,在生成文件并发送下载提示后,将用户重定向到一个新页面。只是添加header("Location: /newpage")一直到最后都没有起作用,我期待着,所以我不知道该如何调整这个。
3 回答
白衣非少年
TA贡献1155条经验 获得超0个赞
[a href="create_csv.php"]here[/a].
HTML: [meta http-equiv="refresh" content="5;url=http://site/create_csv.php"]JavaScript: location.href = 'http://site/create_csv.php';如果: [iframe src="create_csv.php"][/iframe]
弑天下
TA贡献1818条经验 获得超8个赞
header('Set-Cookie: fileLoading=true');setInterval(function(){
if ($.cookie("fileLoading")) {
// clean the cookie for future downoads
$.removeCookie("fileLoading");
//redirect
location.href = "/newpage";
}},1000);- 3 回答
- 0 关注
- 728 浏览
添加回答
举报
0/150
提交
取消
