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实现mysql数据库备份类
Mar 20 PHP
php AJAX实例根据邮编自动完成地址信息
Nov 23 PHP
php 上传文件类型判断函数(避免上传漏洞 )
Jun 08 PHP
PHP连接MongoDB示例代码
Sep 06 PHP
浅析PHP页面局部刷新功能的实现小结
Jun 21 PHP
php 不使用js实现页面跳转
Feb 11 PHP
php实现cc攻击防御和防止快速刷新页面示例
Feb 13 PHP
PHP中$this和$that指针使用实例
Jan 06 PHP
PHP实现HTML页面静态化的方法
Nov 04 PHP
PHP结合Mysql数据库实现留言板功能
Mar 04 PHP
WordPress中设置Post Type自定义文章类型的实例教程
May 10 PHP
[原创]php实现 data url的图片生成与保存
Dec 04 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
php简单封装了一些常用JS操作
2007/02/25 PHP
PHP高级OOP技术演示
2009/08/27 PHP
php防止sql注入示例分析和几种常见攻击正则表达式
2014/01/12 PHP
浅谈php和.net的区别
2014/09/28 PHP
php+mysql大量用户登录解决方案分析
2014/12/29 PHP
PHP获取指定月份第一天和最后一天的方法
2015/07/18 PHP
Laravel框架实现redis集群的方法分析
2017/09/14 PHP
PHP 断点续传实例详解
2017/11/11 PHP
PHP有序表查找之插值查找算法示例
2018/02/10 PHP
微信公众平台开发教程④ ThinkPHP框架下微信支付功能图文详解
2019/04/10 PHP
Laravel 将数据表的数据导出,并生成seeds种子文件的方法
2019/10/09 PHP
laravel admin实现分类树/模型树的示例代码
2020/06/10 PHP
简单的jquery拖拽排序效果实现代码
2011/09/20 Javascript
jQuery+CSS 半开折叠效果原理及代码(自写)
2013/03/04 Javascript
用javascript替换URL中的参数值示例代码
2014/01/27 Javascript
JavaScript实现表格快速变色效果代码
2015/08/19 Javascript
jQuery版本升级踩坑大全
2016/01/12 Javascript
举例讲解jQuery对DOM元素的向上遍历、向下遍历和水平遍历
2016/07/07 Javascript
将form表单通过ajax实现无刷新提交的简单实例
2016/10/12 Javascript
微信小程序 后台登录(非微信账号)实例详解
2017/03/31 Javascript
nodejs入门教程二:创建一个简单应用示例
2017/04/24 NodeJs
VUE中v-model和v-for指令详解
2017/06/23 Javascript
微信小程序时间标签和时间范围的联动效果
2019/02/15 Javascript
记一次vue-webpack项目优化实践详解
2019/02/17 Javascript
分享Angular http interceptors 拦截器使用(推荐)
2019/11/10 Javascript
jQuery实现简单评论区功能
2020/10/26 jQuery
[01:03:09]完美世界DOTA2联赛PWL S2 Forest vs SZ 第二场 11.25
2020/11/26 DOTA
python实现list由于numpy array的转换
2018/04/04 Python
python实现生成Word、docx文件的方法分析
2019/08/30 Python
TensorFlow获取加载模型中的全部张量名称代码
2020/02/11 Python
Pytorch mask_select 函数的用法详解
2020/02/18 Python
python实现图片素描效果
2020/09/26 Python
大女孩胸罩:Big Girls Bras
2016/12/15 全球购物
《会变的花树叶》教学反思
2014/02/10 职场文书
2015年六年级班主任工作总结
2015/10/15 职场文书
Django+Nginx+uWSGI 定时任务的实现方法
2022/01/22 Python