APK 파일 다운로드를 위해 카운터를 늘린 다음이 파일을 브라우저로 다운로드하여 다운로드합니다.apk 파일을 강제로 다운로드하기위한 헤더
여기에 내가 가진 무엇 :
<?php
$file = "android.apk";
function force_download($file){
header("Pragma: public", true);
header("Expires: 0"); // set expiration time
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Disposition: attachment; filename=".basename($file));
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($file));
die(file_get_contents($file));
}
force_download($file
문제는 파이어 폭스와 같은 브라우저, 그것은 다운로드 것을이지만 같다 'android.apk - 0 바이트'. 기본적으로 파일 내용을 다운로드하지 않습니다.
내가 뭘 잘못하고 있니? 이것에 대한 해결책?
중요 : 모바일에서 작동해야합니다.
);
file_get_contents ($ file)가 파일을 읽을 수 있는지 확인하고, 헤더없이 테스트하십시오. – RezaSh