我试图根据当前设置的 GET 参数创建一些链接。
我的网址如下所示:
http://mysite.com/index.php?bar=test&page=page
在我的代码中,我执行以下操作:
$bar = $_REQUEST['bar'];
<a href="index.php?bar=<?php echo $bar?>&page=anotherpage"
但是每次我单击链接时,它都会再次将整个字符串添加到 URL 中。
就像第一次点击会给我这个网址:
http://mysite.com/index.php?bar=test&page=anotherpagepage=anotherpage
下一步点击创建:
http://mysite.com/index.php?bar=test&page=anotherpagepage=anotherpagepage=anotherpage
等等。
有没有办法只获取一次请求,以便 URL 始终如下所示:
http://mysite.com/index.php?bar=test&page=anotherpage
无论我点击链接多少次?
非常感谢!