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针对常规模板引擎中与CSS/JSON冲突的解决方法

本文实例讲述了PHP针对常规模板引擎中与CSS/JSON冲突的解决方法,有一定的实用价值,具体分析如下: 本文主要针对对象为Smarty与Dwoo 在Smarty中经常会出现和CSS/J...

PHP实现获取并生成数据库字典的方法

PHP实现获取并生成数据库字典的方法

本文实例讲述了PHP实现获取并生成数据库字典的方法。分享给大家供大家参考,具体如下: <?php /** * 生成mysql数据字典 */ header("Con...

如何使用脚本模仿登陆过程

查看他的登陆页面的代码, 看他提交到哪个页面, 变量是什么。复制代码 代码如下:<form method="post" action="lo...

php实现的数组转xml案例分析

本文实例讲述了php实现的数组转xml。分享给大家供大家参考,具体如下: 0x00 需求 最近要做百度、360、神马搜索的网站sitemap,三家的格式都是xml,然而具体的细节还有有差...

发一个php简单的伪原创程序,配合商城采集用的

复制代码 代码如下: <?php $arr=array(); $arr['好']='坏'; $arr['不好']='不坏'; $arr['坏']='好'; $arr['不坏']='...