使用PHP下载apk

时间:2015-11-07 08:10:42

标签: php android

我想下载放在我的Windows服务器上的APK。该文件存在。 PHP脚本如下所示

<?php
 $file = '/45.34.14.285/n1/n.apk'; //not public folder
  if (file_exists($file)) {
     header('Content-Description: File Transfer');
     header('Content-Type: application/vnd.android.package-archive');
     header('Content-Disposition: attachment; filename='.basename($file));
     header('Content-Transfer-Encoding: binary');
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
     header('Pragma: public');
     header('Content-Length: ' . filesize($file));
     ob_clean();
     flush();
     readfile($file);
     exit;
 }
else
{
echo 'No File Found';
}
?>

但它返回

  

&#39;找不到文件&#39;

0 个答案:

没有答案
相关问题