PHP文件下载

<?php
	$fileName=$_GET['file'];
	header('Content-type:application/force-download');
	header('Content-Disposition:attachment;filename='.$fileName);
	
	$fp=fopen("文件目录".$fileName, "r");
	$content=fread($fp, filesize("文件目录".$fileName));
	echo $content;
?>

调用:
http://../frostbelt_download.php?file=download.jpg

  

原文地址:https://www.cnblogs.com/frostbelt/p/2153406.html