跳转核心代码实现。
复制代码代码如下:
if(isset($link))
{
Header("HTTP/1.1303SeeOther");
Header("Location:$link");
exit;
}
下面是国外的一篇文章说明。
HeyChris:
OnWed,Jan26,2005at12:28:19PM-0500,csnyderwrote:
>
><?php
>//processform
>...
>//redirecttoresultspage
>header('HTTP/1.1303SeeOther');
>header('Location:result.html');
>exit('Formsubmitted,continue.');
>?>
Goodpoint.Butsomefeedbackhere.Theoptimailsyntaxis:
//processform
//...
//redirecttoresultspage
header('Status:303SeeOther');
header('Location:http://www.jb51.net/result.html');
?>
Here'swhy...
Using"Status:"intheheaderisbetterbecausetheresultingheadersfrom
Apachearemorecorrect:
HTTP/1.1303SeeOther
insteadof
HTTP/1.1303
Additionally,onedoesn'treallyknowwhichversionofHTTPisbeingused,
sowhypotentiallycauseproblemsbytryingtoguess.
ThespecssaylocationheadersmusthaveacompleteURIinthem,notjust
thepath.
Lastly,youdon'twantanyoutputafterthelocationheader.
Later,
--Dan
您可能感兴趣的文章:PHP实现远程下载文件到本地php实现当前页面点击下载文件的实例代码php中强制下载文件的代码(解决了IE下中文文件名乱码问题)php下载文件源代码(强制任意文件格式下载)php实现从ftp服务器上下载文件树到本地电脑的程序PHP/ThinkPHP实现批量打包下载文件的方法示例PHP下载文件时自动添加bom头的方法实例PHP下载文件时如何自动添加bom头及解释BOM头和去掉bom头的方法php实现SAE上使用storage上传与下载文件的方法PHP实现从远程下载文件的方法php+js实现的无刷新下载文件功能示例
本文介绍了HTTP状态码303 SeeOther在PHP中的应用,展示了如何通过设置Header进行页面跳转。文章讨论了使用'Location'头和'Status'头的差异,并强调了正确格式化URI的重要性,同时还提供了PHP代码示例来实现重定向。
1691

被折叠的 条评论
为什么被折叠?



