如url的链接:http://localhost/redirect.php?url=http://www.google.cn/search?sourceid=navclient-ff&ie=UTF-8&rls=GGGL,GGGL:2006-43,GGGL:en&q=phpurl
程序代码如下:
//接收url
$dest=$_GET['url'];
//将断开的url存入数组
if (isset($HTTP_GET_VARS))
foreach (array_keys($HTTP_GET_VARS) as $key)
{
if ($key != 'articleid' && $key != 'url')
$vars[] = $key.'='.$HTTP_GET_VARS[$key];
}
//将数组拆分并组合成字符串
$url = $dest.'&'.implode("&", $vars);
//重定向
header("Location: ".$url);
程序代码如下:
//接收url
$dest=$_GET['url'];
//将断开的url存入数组
if (isset($HTTP_GET_VARS))
foreach (array_keys($HTTP_GET_VARS) as $key)
{
if ($key != 'articleid' && $key != 'url')
$vars[] = $key.'='.$HTTP_GET_VARS[$key];
}
//将数组拆分并组合成字符串
$url = $dest.'&'.implode("&", $vars);
//重定向
header("Location: ".$url);