你可以改成这样:
1.php
<?
echo "<a herf=bounce.php?URL=http://www.circuitcity.com/rpsm/oid/136479/rpem/ccd/RebateDetails.do target=_blank>Link</a>";
?>bounce.php
<?
header("Location:".$_GET['URL']);
?>
1.php
<?
echo "<a herf=bounce.php?URL=http://www.circuitcity.com/rpsm/oid/136479/rpem/ccd/RebateDetails.do target=_blank>Link</a>";
?>bounce.php
<?
header("Location:".$_GET['URL']);
?>
这样写的话,url中只有一个参数的可以正常跳转,但传递的url带多个参数的话,就会丢失参数,而不能到达所指向的页面
比如:
1.php
<a href="109.php?URL=http://accessories.us.dell.com/sna/productdetail.aspx?c=us&l=en&cs=04&sku=A0204404" target="_blank">link</a>
bounce.php
<?
header("Location:".$_GET['URL']);
?>
点击之后并不能转到http://accessories.us.dell.com/sna/productdetail.aspx?c=us&l=en&cs=04&sku=A0204404
我怀疑是传递参数过程中,只要遇见“&”符号,后面的参数就被截断了。
请求各位帮助,谢谢!
把&替换成%26
外国网站上很多这样传递连接的方式,例如:
http://clickserve.cc-dt.com/link/click?lid=41000000003010015&redirect=http://www.shop4tech.com/user.htm?go=view_item&id=3741这里并没有把&转换,不知道他们是怎么得到带多参数url变量的值。
<?
echo "<a herf=bounce.php?http://www.circuitcity.com/rpsm/oid/136479/rpem/ccd/RebateDetails.do target=_blank>Link</a>";
?>bounce.php
header("location:$_SERVER['QUERY_STRING']");
<?
echo "<a herf=bounce.php?URL=".urlencode(http://www.circuitcity.com/rpsm/oid/136479/rpem/ccd/RebateDetails.do)." target=_blank>Link</a>";
?>bounce.php
<?
header("Location:".urldecode($_GET['URL']));
?>