This article mainly introduces the simple method of downloading PHP files and adding response headers. Interested friends can refer to it. I hope it will be helpful to everyone.
is as follows:
//下载,添加响应头信息 header('Content-type:application/octet-stream'); header('Content-Disposition:attachment;filename="'.basename($file).'"'); header('Content-Length:'.filesize($file)); readfile($file);
Summary: The above is all of this article Content, I hope it will be helpful to everyone's study.
Related recommendations:
Use php to realize automatic login storage mechanism within a week
PHP Implement the thief program example
Use php to interact with the server and web front-end interface
##
The above is the detailed content of PHP download file, a simple way to add response headers. For more information, please follow other related articles on the PHP Chinese website!