2012-10-03 5 views
1
<a href="download.php"><img src="images/android/android01.jpg"/>Android</a> 

링크를 새로 고침 :APK는 PHP로 다운로드가 정의되지 않은 제공하지만 브라우저 다운로드 후 작품에

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; 
} 

내가 파이어 폭스 데스크톱 브라우저와 휴대 전화에서 정의되지 않은 출력을 얻을. 브라우저를 새로 고침하면 다운로드 대화 상자가 시작되고 apk 파일을 다운로드합니다. 빈 페이지에서 정의되지 않은 출력을 처리하고 대화 상자를 immediatly 다운로드 할 수있는 방법에 대한 아이디어가 있습니까?

+0

당신이 정의되지 않은 출력에 의해 무엇을 의미합니까? –

+0

첫 번째 줄에 정의되지 않은 단어가있는 빈 웹 페이지가 반환됩니다 .. – user1716504

+0

? 이상한데 ... '정의되지 않은 것'밖에 없나요? –

답변

0

대신이 시도 :

<a href="#" onClick="window.location='download.php'"> 
    <img src="images/android/android01.jpg"/>Android 
</a> 
관련 문제