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递归json类实例

本文实例讲述了php递归json类的实现方法。分享给大家供大家参考。 具体实现代码如下: 复制代码 代码如下:<?php /*   * @ anth...

php实现zip文件解压操作

PHP解压zip文件函数,源码简短,需要使用 ZZIPlib library 扩展,使用前请确认该扩展已经开启。 <? /*********************...

php文件上传 你真的掌握了吗

php文件上传 你真的掌握了吗

这里首先声明一下这一章的内容比较多,比较难,你要抱着和自己死磕的态度。细微之处不放过,多敲多练是王道。 学习就像爬山,得一步一步来,首先给自己定一个小目标,然后再坚持不懈地往高出攀爬,...

PHP使用pdo连接access数据库并循环显示数据操作示例

本文实例讲述了PHP使用pdo连接access数据库并循环显示数据操作。分享给大家供大家参考,具体如下: PDO连接与查询: try { $conn = new PDO("odbc:...

如何在Ubuntu下启动Apache的Rewrite功能

在终端中执行 sudo a2enmod rewrite 指令后,即启用了 Mod_rewrite 模块。 另外,也可以通过将 /etc/apache2/mods-available/re...