如何通过php设置链接url?
我已经做了14个url链接。我有一个问题,当我按下链接2时,它返回1,而所有剩余的链接返回递减到原始值。例如,当我按3时,它返回2。当我按4时,它返回3,依此类推。我想知道这是为什么。如何通过php设置链接url?,php,Php,我已经做了14个url链接。我有一个问题,当我按下链接2时,它返回1,而所有剩余的链接返回递减到原始值。例如,当我按3时,它返回2。当我按4时,它返回3,依此类推。我想知道这是为什么。这是代码 <html> <body> <head> <title>Paging</title> <style> #numberDiv {
这是代码
<html>
<body>
<head>
<title>Paging</title>
<style>
#numberDiv
{
display: inline-block;
border: 1px solid black;
width: 35px;
height: 35px;
margin-left: 0.01px;
background-color: aliceblue;
}
</style>
</head>
<?php
if (isset($_GET["id"]))
{
$id=$_GET["id"];
echo $id;
echo "<br>";
}
$a=14;
$b=1;
$c=1;
for ($b = 1; $b <= $a; $b++) {
?><a href="zain.php?id=<?php echo $c; ?>" style="text-decoration: none; text-align: center;color: black;font-size: x-large">
<?php
$c=$b;
echo "<div id='numberDiv'>" . $c . "</div>" ?></a><?php
}
?>
</body>
</html>
寻呼
#第五号
{
显示:内联块;
边框:1px纯黑;
宽度:35px;
高度:35px;
左边距:0.01px;
背景色:aliceblue;
}
使用以下代码。它会对你有用的
<html>
<body>
<head>
<title>Paging</title>
<style>
#numberDiv
{
display: inline-block;
border: 1px solid black;
width: 35px;
height: 35px;
margin-left: 0.01px;
background-color: aliceblue;
}
</style>
</head>
<?php
if (isset($_GET["id"]))
{
$id=$_GET["id"];
echo $id;
echo "<br>";
}
$a=14;
$b=1;
$c=1;
for ($b = 1; $b <= $a; $b++) {
$c=$b;
?><a href="zain.php?id=<?php echo $c; ?>" style="text-decoration: none; text-align: center;color: black;font-size: x-large">
<?php
echo "<div id='numberDiv'>" . $c . "</div>" ?></a><?php
}
?>
</body>
</html>
寻呼
#第五号
{
显示:内联块;
边框:1px纯黑;
宽度:35px;
高度:35px;
左边距:0.01px;
背景色:aliceblue;
}
当您回显链接时,您的作业$c=$b
在后面。你为什么还需要$c
?你为什么要使用$c
?您可以指定$b
而不是$c
。预期的行为是什么?它返回的是您在这里的意思<代码>我出于某种目的需要它