-5

.app ファイルのダウンロードを強制しようとしています。

次のことを試してみましたが、空の .app ファイルが表示されるだけです:

<?php
    header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Disposition: attachment; filename=Application.app");
    header("Content-Type: application/zip");
    header("Content-Transfer-Encoding: binary");

?>
4

3 に答える 3

1

交換

header("Content-Type: application/zip");

header("Content-Type: application/octet-stream");

そして ie でファイルを出力しますreadfile()?>また、タグを削除することをお勧めします。したがって、次のようになります。

<?php
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=Application.app");
header("Content-Type: application/zip");
header("Content-Transfer-Encoding: binary");

readfile('Application.app');     // replace Application.app with right filename or full path to subject file
于 2013-07-25T19:03:48.317 に答える
0

最後に次の行を追加します。

readfile('Application.app');

ファイルの内容を出力していないためです。

于 2013-07-25T19:04:55.537 に答える
0
<?php
$file = "http://example.com/application.app"; 

header("Content-Description: File Transfer"); 
header("Content-Type: application/zip");  // proper octet-stream
header("Content-Disposition: attachment; filename=\"$file\""); 

readfile ($file); 
?>

ファイルがブラウザで開かない場合..

<?php header("Location: http://example.com/application.app"); ?>
于 2013-07-25T19:10:52.580 に答える