2
CSV 파일을 다운로드하도록 요청하는 기능이 있습니다. 그러나 파일 이름은 Mozilla 브라우저에서는 완료되지 않지만 Chrome에서는 잘 작동합니다. 파일 이름이 F1_Open_marksheet.csv을해야하는 경우 예를 들어, 모질라는 F1로 다운로드 (파일 이름과 확장자의 나머지 부분을 누락 메시지가 표시됩니다. 내 코드는 버그가 있음을 수 있을까?파일 다운로드 기능이 전체 파일 이름 및 내선 번호를 첨부하지 못했습니다.
<?php
function pushDownloadFile($filename){
header('Content-Description: File Transfer');
header('Content-Type: text/csv; charset=utf-8');
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($filename));
ob_clean();
flush();
readfile($filename);
unlink($filename);
}
?>
귀하의 기능에 괄호가 없습니다.}}' –
[HTTP의 Content-Disposition 헤더 파일 이름 매개 변수를 인코딩하는 방법] (http://stackoverflow.com/questions/93551/how-to-encode-the-filename-parameter-of-content-disposition)의 가능한 복제본 -header-in-http) – CBroe