php download.php实现代码 跳转到下载文件(response.redirect)


Posted in PHP onAugust 26, 2009

跳转核心代码实现。

if (isset($link)) 
                { 
                    Header("HTTP/1.1 303 See Other"); 
                    Header("Location: $link"); 
                    exit; 
                }

下面是国外的一篇文章说明。
Hey Chris:
On Wed, Jan 26, 2005 at 12:28:19PM -0500, csnyder wrote:
>
> <?php
> // process form
> ...
> // redirect to results page
> header( 'HTTP/1.1 303 See Other' );
> header( 'Location: result.html' );
> exit( 'Form submitted, <a href="result.html">continue</a>.' );
> ?>
Good point. But some feedback here. The optimail syntax is:
<?php
// process form
// ...
// redirect to results page
header('Status: 303 See Other' );
header('Location: https://3water.com/result.html');
?>
Here's why...
Using "Status:" in the header is better because the resulting headers from
Apache are more correct:
HTTP/1.1 303 See Other
instead of
HTTP/1.1 303
Additionally, one doesn't really know which version of HTTP is being used,
so why potentially cause problems by trying to guess.
The specs say location headers must have a complete URI in them, not just
the path.
Lastly, you don't want any output after the location header.
Later,
--Dan

PHP 相关文章推荐
PHP入门速成(2)
Oct 09 PHP
十天学会php(2)
Oct 09 PHP
php4的session功能评述(一)
Oct 09 PHP
PHP文章采集URL补全函数(FormatUrl)
Aug 02 PHP
全面解读PHP的Yii框架中的日志功能
Mar 17 PHP
php快速排序原理与实现方法分析
May 26 PHP
php flush无效,IIS7下php实时输出的方法
Aug 25 PHP
PHP弱类型的安全问题详细总结
Sep 25 PHP
PHP二分查找算法示例【递归与非递归方法】
Sep 29 PHP
Laravel如何使用数据库事务及捕获事务失败后的异常详解
Oct 23 PHP
PHP实现的多维数组去重操作示例
Jul 21 PHP
php遍历目录下文件并按修改时间排序操作示例
Jul 12 PHP
php 文件夹删除、php清除缓存程序
Aug 25 #PHP
php 正则匹配函数体
Aug 25 #PHP
PHP has encountered an Access Violation at 7C94BD02解决方法
Aug 24 #PHP
PHP 替换模板变量实现步骤
Aug 24 #PHP
PHP 开源AJAX框架14种
Aug 24 #PHP
PHP 开源框架22个简单简介
Aug 24 #PHP
php xml留言板 xml存储数据的简单例子
Aug 24 #PHP
You might like
老机欣赏|中国60年代精品收音机
2021/03/02 无线电
PHP中运用jQuery的Ajax跨域调用实现代码
2012/02/21 PHP
PHP中soap的用法实例
2014/10/24 PHP
PHP curl 或 file_get_contents 获取需要授权页面的方法
2017/05/05 PHP
在Laravel中使用MongoDB的方法示例
2019/11/11 PHP
JScript的条件编译
2007/05/29 Javascript
JavaScript 语言的递归编程
2010/05/18 Javascript
jQuery中offset()方法用法实例
2015/01/16 Javascript
js获取及修改网页背景色和字体色的方法
2015/12/29 Javascript
Angularjs在初始化未完毕时出现闪烁问题的解决方法分析
2016/08/05 Javascript
微信小程序 video详解及简单实例
2017/01/16 Javascript
浅谈js中function的参数默认值
2017/02/20 Javascript
jQuery实现表格奇偶行显示不同背景色 就这么简单
2017/03/13 Javascript
iscroll动态加载数据完美解决方法
2017/07/18 Javascript
jquery实现企业定位式导航效果
2018/01/01 jQuery
vue axios封装httpjs,接口公用配置拦截操作
2020/08/11 Javascript
axios解决高并发的方法:axios.all()与axios.spread()的操作
2020/11/09 Javascript
[00:53]TI3正赛第三天 DK怒破A队不败金身 现场国旗飘扬热血激昂
2013/08/10 DOTA
python将html转成PDF的实现代码(包含中文)
2013/03/04 Python
python多进程使用及线程池的使用方法代码详解
2018/10/24 Python
pytorch对可变长度序列的处理方法详解
2018/12/08 Python
Tensorflow模型实现预测或识别单张图片
2019/07/19 Python
Python发送邮件的实例代码讲解
2019/10/16 Python
Windows上安装tensorflow  详细教程(图文详解)
2020/02/04 Python
python request 模块详细介绍
2020/11/10 Python
CSS3实现类似翻书效果的过渡动画的示例代码
2019/09/06 HTML / CSS
SmartBuyGlasses美国官网:太阳眼镜和眼镜
2017/08/20 全球购物
如何撰写岗位职责
2014/02/01 职场文书
2014年档案管理员工作总结
2014/12/01 职场文书
消防演习通知
2015/04/25 职场文书
三方合作意向书范本
2015/05/09 职场文书
公司人力资源管理制度
2015/08/05 职场文书
SQL SERVER中常用日期函数的具体使用
2021/04/08 SQL Server
分享一个vue实现的记事本功能案例
2022/04/11 Vue.js
Java后端 Dubbo retries 超时重试机制的解决方案
2022/04/14 Java/Android
解决Python保存文件名太长OSError: [Errno 36] File name too long
2022/05/11 Python