头像

php强制图片下载的代码

2018-04-11 14:42:49 浏览()   来源:http://www.phpdaima.com//jsfx-35.html   评论 ( 0 )   

<?php
//unction downloadFile($file){ 
$file_name = $file; 
$mime = 'application/force-download'; 
header('Pragma: public'); // required 
header('Expires: 0'); // no cache 
header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 
header('Cache-Control: private',false); 
header('Content-Type: '.$mime); 
header('Content-Disposition: attachment; filename="'.basename($file_name).'"'); 
header('Content-Transfer-Encoding: binary'); 
header('Connection: close'); 
readfile($file_name); // push it out 
exit(); 
}
?>


标签: php
广告不存在
评论0

后面还有条评论,点击查看>>

温馨提示:为规范评论内容,垃圾评论一律封号...