简体   繁体   中英

php header() function problem about download file

I have a file download function in my website. it works fine before. but after we moved the site to another server with runs PHP 5 (it runs on PHP 4 before). when click to download, it automatically adds a extra blank line at the beginning and the end of the file which we don't want to. Here is the code for downloading function:

header("Content-Type: application/gas");
header("Cache-control: private");    
header("Content-Disposition: attachment; filename=aaa.gas");

Could anyone please help me out? Thanks!

There may be an extra blank line after the ?> that closes the PHP within the script. Exit the script after sending the file in order to prevent this from mattering.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM