php 页面跳转实现程序代码
最简单的就是利用php header实现
代码是:
<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy4980')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy4980><?php
header("Location:http://www.jiaochengji.com/");
?>
或者:
<? header("location:index123.php"); ?>
通过get或post获取值再跳转
有时候可以看到http://www.xxx.com/url.php?url=http://www.baidu.com,然后就跳转到百度。
如何用php实现这个url跳转呢?
只用简单的几行代码,就可以实现。
<?php
$url=$_GET["url"];
header("Location:".$url);
?>
PHP 301转向实现代码
<table width="620" align="center" border="0" cellpadding="1" cellspacing="1" style="background:#FB7"> <tr> <td width="464" height="27" bgcolor="#FFE7CE"> 代码如下</td> <td width="109" align="center" bgcolor="#FFE7CE" style="cursor:pointer;" onclick="doCopy('copy7202')">复制代码</td> </tr> <tr> <td height="auto" colspan="2" valign="top" bgcolor="#FFFFFF" style="padding:10px;" class="copyclass" id=copy7202><?php
$url=""];
header("HTTP/1.1 301 Moved Permanently");
header ("Location:$url");
?>
在ff看到状态代码
容易吧.要测试就用curl这个小软件来检查.
#curl -I
HTTP/1.0 301 Moved Permanently
Date: Tue, 06 May 2008 06:27:39 GMT
Server: apache
Location:
如见到上面的HTTP/1.0 301 Moved Permanently
您可能感兴趣的文章:
php如何实现页面跳转
PHP 登录完成跳转上一访问页面
php页面跳转与定时跳转页面方法
PHP实现301跳转,及延时跳转代码
php页面跳转函数 页面重定向
PHP页面跳转代码的三种实现方式
PHP页面跳转的几种方式
PHP页面跳转的三种方法
php页面跳转另一页面各种跳转页面代码
php实现页面跳转的几种方法