【发布时间】:2016-03-01 11:14:57
【问题描述】:
我需要下载一个 apk 应用程序,但我需要将用户保留在我的页面中或将他重定向到另一个页面 带有标题我只能下载应用程序或将他重定向到另一个页面,但我不能同时做这两个 我的 php 代码:
$b= "location";
echo "<script>window.location.href = '$b';</script>" ;
$file = 'apk.apk';
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($file).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
readfile($file);
}
【问题讨论】:
-
你能解释一下这个网址中给出的解决方案吗?
标签: php file redirect download header