1
<a href="download.php"><img src="images/android/android01.jpg"/>Android</a>

リンク先:

phpコード:

$file = 'myfile.apk';
$filename ="MYAPP";
if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/vnd.android.package-archive');
    header("Content-Disposition:attachment; filename=\"$filename\"");
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));
    ob_clean();
    flush();
    readfile($file);
    exit;
}

Firefox デスクトップ ブラウザーと電話で未定義の出力が表示されます。ブラウザを更新すると、ダウンロード ダイアログが起動し、apk ファイルがダウンロードされます。空白のページで未定義の出力を回避し、すぐにダウンロード ダイアログに移動する方法についてのアイデアはありますか?

4

1 に答える 1

0

代わりにこれを試してください:

<a href="#" onClick="window.location='download.php'">
  <img src="images/android/android01.jpg"/>Android
</a>
于 2012-10-12T14:24:06.853 に答える