您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

php通过修改header强制图片下载的方法,_PHP教程

2024/3/2 9:39:40发布31次查看
php通过修改header强制图片下载的方法,本文实例讲述了php通过修改header强制图片下载的方法。分享给大家供大家参考。具体实现方法如下:
function 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程序设计有所帮助。
http://www.bkjia.com/phpjc/972638.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/972638.htmltecharticlephp通过修改header强制图片下载的方法, 本文实例讲述了php通过修改header强制图片下载的方法。分享给大家供大家参考。具体实现方法如下:...
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product