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

yipeiwu_com5年前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

相关文章

PHP5.5在windows安装使用memcached服务端的方法

PHP5.5在windows安装使用memcached服务端的方法

  PHP5.5 在windows下安装 memcached 的方法   下载服务端资源   http://download.csdn.net/detail/zsjangel/71047...

php模拟post提交数据的方法

本文实例讲述了php模拟post提交数据的方法。分享给大家供大家参考。具体如下: php模拟post提交数据,用处很多,可用来网站的采集,登陆等等 这里以我项目中的论坛登录为例加以说明:...

php array_merge函数使用需要注意的一个问题

使用php语言的array_merge函数时,以为相同的键名会覆盖,但是请看如下代码: 复制代码 代码如下: $a1 = array(1=>'abc', 3=>10); $a...

PHP判断浏览器、判断语言代码分享

PHP编程中经常需要用到一些服务器的一些资料,特把$_SERVER的详细参数整理下,方便以后使用。 判断浏览器类型 //判断类型 <?php if(strpos($...

php jq jquery getJSON跨域提交数据完整版

前端请求端: 复制代码 代码如下: <script> $(function() { $.getJSON('http://test.com/aa.php?callback=?'...