使用php在一个页面中获取多个$\u参数
我创建了一个页面,其中有两个页码,一个用于问题,一个用于答案 我在问题的底部有像使用php在一个页面中获取多个$\u参数,php,Php,我创建了一个页面,其中有两个页码,一个用于问题,一个用于答案 我在问题的底部有像这样的链接作为页码,在答案的底部有这样的链接 假设我的当前url是index.php?answerPageNumber=11,当我单击问题页面时,我会松开当前页面 如何使用$\u get参数处理这些问题 假设我当前的url是index.php?answerPageNumber=11,当我单击问题的第四页时,它应该变成index.php?answerPageNumber=11&questionPageNumber=4。
这样的链接作为页码,在答案的底部有
这样的链接
假设我的当前url是index.php?answerPageNumber=11
,当我单击问题页面时,我会松开当前页面
如何使用$\u get参数处理这些问题
假设我当前的url是
index.php?answerPageNumber=11
,当我单击问题的第四页时,它应该变成index.php?answerPageNumber=11&questionPageNumber=4
。在编写链接检查get变量时,需要包含php。大概是这样的:
<a href="index.php?questionPageNumber=4">Questions</a>
将变成这样:
<?php
$link="index.php?";
if(isset($_GET["answerPageNumber"]))
$link.="answerPageNumber=".$_GET["answerPageNumber"]."&";
$link.="questionPageNumber=4";
?>
<a href="<?php echo $link; ?>">Questions</a>