내 프로젝트에서 xxx.zip 파일을 다운로드하고 싶습니다.php 다운로드 중 파일 다운로드 대화 상자가 표시되지 않는 이유
내 아파치 서버의 파일을 검사 한 :
/usr/local/apache2/conf/httpd.conf
이 파일의 MIME은 두 AddType 지정이 : 내가 한 그
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
두 가지 유형이 우편을 지원할 수없는, 그래서 타격을 추가 :
AddType application/zip .zip
그리고이 후, 나는 성공적 httpd 서비스를 다시 시작 :
내 웹 사이트에 대신 다운로드 대화 상자의 messcy 코드를 직접 xxx.zip의<?php
$file_name="xxx.zip";
header("Cache-Control: no-cache, must-revalidate");
header("Expires: 0");
header("Content-Disposition: attachment; filename=".basename($file_name));
header("Content-Length:".filesize($file_name));
header("Content-Type:application/zip");
readfile($file_name);
exit;
?>
그러나 불운, 내 브라 우어 공개 콘텐츠 및이있다 : 6,
service httpd restart
는 그리고 PHP는 다운로드를 실행
@ӓ�����'t�� :�>]x�I�1W`� ���:�V2g�z����m^ ��Ӄ&8�E���l�:�kؖb��uƘ�z���qD���w�4��p��^&���s�����i/ݽ�mUH�F�x[`�:��#Nr��+|�n�i����ό�U#�}=!j�D�4�}=�'ujc�`��}hl�cr�"��T6���Λb��"/ ���k�vo$%��x/y���Q�����n�����Y�
다운로드 파일 대화 상자가 표시되지 않는 이유는 무엇입니까? 내 리눅스 서버, 브라우저 및 DB는 utf8 세트를 사용합니다. 누가 날 도울 수 있죠 ? 다른 파일 형식을 시도했습니다. 예 : jpeg, png, 그들은 모두 파일 대화 상자를 다운로드하지 않고 직접 열 수 있습니다.
나에게 코드를 보여줄 수 있습니까? – Snow