How to download a file using php?
问题 I want to download file from my server using php. I searched google and found a stackoverflow answer here. This answer shows that I have to write these codes for this purpose. $file_url = 'http://www.myremoteserver.com/file.exe'; header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"" . basename($file_url) . "\""); readfile($file_url); But I am able to do this with merely these two lines: header(