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

yipeiwu_com6年前PHP代码库
跳转核心代码实现。
复制代码 代码如下:

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: //www.jb51.net/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页面运行时间的函数。复制代码 代码如下:<?php/*@ 计算php程序运行时间*/function microtime_float(){list($usec, $s...

PHP7.1安装yaf扩展的方法

把PHP命令加到系统 我的PHP安装目录是/usr/local/webserver/php,所以phpize是/usr/local/webserver/php/bin/phpize,但是...

PHP+redis实现微博的推模型案例分析

本文实例讲述了PHP+redis实现微博的推模型。分享给大家供大家参考,具体如下:最近在看了一下关于redis的内容,然后利用redis写了一个简单的微博项目,这篇文章是关于推模型的。推模型所谓推模型...

关于Iframe如何跨域访问Cookie和Session的解决方法

最近做登录系统的整合,其中遇到的一个最关键的问题为在一个统一的后台里需要无障碍的访问另外一个系统后台,这个系统是第三方提供的一个加过密的系统,后台自动登录接口是自己分析出来的,没有单独提...

php中filter_input函数用法分析

本文实例分析了php中filter_input函数用法。分享给大家供大家参考。具体分析如下: 在 php5.2 中,内置了filter 模块,用于变量的验证和过滤,过滤变量等操作,这里我...