PHP Android如何下载apk文件

时间:2012-08-20 13:58:26

标签: php android download apk force-download

我的服务器上有Android应用程序,并且还有如下代码的PHP代码:

header('Content-Type: application/vnd.android.package-archive');
header('Content-Disposition: attachment; filename="test.apk"');
readfile('test.apk');

我的手机默认网页浏览器是以在屏幕上阅读apk文件的方式下载此文件。我期待某种对话,例如:将其保存为或/和您想要保存在哪里。 我做错了什么? 有没有办法自动保存它,这意味着没有任何对话?

2 个答案:

答案 0 :(得分:0)

尝试:

header("Cache-Control: public");
header("Content-Description: File Transfer");
header('Content-Type: application/vnd.android.package-archive');
header("Content-Transfer-Encoding: binary");    
header('Content-Disposition: attachment; filename="test.apk"');
readfile('C4A.apk');

答案 1 :(得分:0)

你应该尝试其中一种:

  1. 检查服务器上的mime类型配置。 APK Files
  2. add the apk extension to apache
  3. 另外,请检查此question。但是服务器是.net,而不是php。