php实现改变图片直接打开为下载的方法

yipeiwu_com6年前PHP代码库

本文实例讲述了php实现改变图片直接打开为下载的方法。分享给大家供大家参考。具体如下:

process.php文件如下:

$file = $_GET['file'];
header("Content-type: octet/stream");
header("Content-disposition:attachment;filename=".$file.";");
header("Content-Length:".filesize($file));
readfile($file);
exit;

html文件如下:

<a href="process.php?file=pic.jpg">Image goes Here</a>

希望本文所述对大家的php程序设计有所帮助。

相关文章

php实现的XML操作(读取)封装类完整实例

本文实例讲述了php实现的XML操作(读取)封装类。分享给大家供大家参考,具体如下: <?xml version="1.0" encoding="utf-8" stan...

PHP载入图像imagecreatefrom_gif_jpeg_png系列函数用法分析

本文实例分析了PHP载入图像imagecreatefrom_gif_jpeg_png系列函数用法。分享给大家供大家参考,具体如下: imagecreatefrom 系列函数用于从文件或...

php上传文件并显示上传进度的方法

本文实例讲述了php上传文件并显示上传进度的方法。分享给大家供大家参考。具体如下: 记得上传文件的时候要大点,不然还没看出来就上传完了,并且上传的文件不要太大,上G的就算了,2G的我试了...

php购物网站支付paypal使用方法

详细参考: https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_htm...

如何在Ubuntu下启动Apache的Rewrite功能

在终端中执行 sudo a2enmod rewrite 指令后,即启用了 Mod_rewrite 模块。 另外,也可以通过将 /etc/apache2/mods-available/re...