php通过修改header强制图片下载
2017-04-06 17:24
288 查看
$file_name = $imgUrl;//图片链接
$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=1.png');
header('Content-Transfer-Encoding: binary');
header('Connection: close');
readfile($file_name); // push it out
exit();
$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=1.png');
header('Content-Transfer-Encoding: binary');
header('Connection: close');
readfile($file_name); // push it out
exit();
相关文章推荐
- php通过修改header强制图片下载的方法
- PHP通过正则表达式下载图片到本地的实现代码
- 通过AFNetworking下载网络闪屏用的图片并存储到本地同时获取header头相关信息
- php如何通过header文件头实现文件下载
- PHP通过fwrite函数和curl修改图片的MD5值
- php中通过正则表达式下载内容中的远程图片的函数代码
- php最简单的方法通过url下载图片。
- php 生成图片带二维码,并且强制用户下载
- 解决PHP Header强制下载IE文件名中文乱码问题
- PHP 利用header()强制用户下载文件
- php通过curl下载远程图片实例
- PHP通过header实现文本文件的下载
- PHP通过header实现文本文件下载的代码
- PHP通过url下载远程图片到本地
- PHP通过url下载远程图片到本地
- 通过AFNetworking下载网络闪屏用的图片并存储到本地同时获取header头相关信息
- php实现生成带二维码图片并强制下载功能
- php简单实现文件或图片强制下载的方法