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自动获取关键字的方法。分享给大家供大家参考。 具体实现方法如下: 复制代码 代码如下:$mincipin=5;//最小词频 $minlen=4;//关键字最小长度...

php无限极分类实现方法分析

php无限极分类实现方法分析

本文实例讲述了php无限极分类实现方法。分享给大家供大家参考,具体如下: 今天给大家带来的是php的无限极分类技术,本人把无限极分类划分为两种。 首先我把数据库表给大家看看,数据库是ta...

PHP对象相互引用的内存溢出实例分析

通常来说使用脚本语言最大的好处之一就是可利用其拥有的自动垃圾回收机制来释放内存。你不需要在使用完变量后做任何释放内存的处理,因为这些PHP会帮你完成。 当然,我们可以按自己的意愿调用 u...

php读取目录及子目录下所有文件名的方法

本文实例讲述了php读取目录及子目录下所有文件名的方法,分享给大家供大家参考。具体实现方法如下: 一般来说php中读取目录下的文件名的方式确实不少,最简单的是scandir,具体代码如下...

PHP检测一个数组有没有定义的方法步骤

PHP检测一个数组有没有定义的方法步骤

php中定义数组的方法: 1、PHP定义数组的格式: 数组名=array(); 如:$aa=array();//这样就定义了一个数组, 之后给元素赋值: $aa[0]="90...