复制代码 代码如下:
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: http://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
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!