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实现有趣的人品测试程序实例

php实现有趣的人品测试程序实例

本文实例讲述了php实现有趣的人品测试程序。分享给大家供大家参考。具体实现方法如下: <html> <head> <meta http-equiv="C...

PHP运行出现Notice : Use of undefined constant 的完美解决方案分享

Notice: Use of undefined constant ALL_PS - assumed 'ALL_PS' in E:\Server\vhosts\www.lvtao.net...

IIS6.0中配置php服务全过程解析

虽然 LAMP 组合很不错,但是如果想要架设一台同时支持 PHP、ASP、ASP.NET、JSP、Perl 的 Web 虚拟主机服务器,还是用 Windows 2003 的 IIS 6...

说明的比较细的php 正则学习实例

"^The": 匹配以 "The"开头的字符串;    "of despair$": 匹配以 "of despair...

php表单提交实例讲解

php表单提交实例讲解

本文为大家分享了一个特别简单的php表单提交实例,具体的实现步骤如下: 实例代码如下: <form action="someform.php" method="post">...