Php 通过url将变量传递到下一页
在这里,我正在计算一个配置文件所有者正在跟踪的人数,如果显示所有被跟踪的人员,则输出编号为打开新页面的链接,计数工作正常,给出了被跟踪的人数,但现在要完成我的下一页,请说Php 通过url将变量传递到下一页,php,Php,在这里,我正在计算一个配置文件所有者正在跟踪的人数,如果显示所有被跟踪的人员,则输出编号为打开新页面的链接,计数工作正常,给出了被跟踪的人数,但现在要完成我的下一页,请说following.php,其中将显示所有被跟踪的人,我需要将变量$id传递到我要使用url方法的页面,请在这方面帮助我 <?php $checkfollowing =$db->prepare("SELECT * FROM follow_user WHERE uid_fk=:id"); $checkfollowing
following.php
,其中将显示所有被跟踪的人,我需要将变量$id
传递到我要使用url方法的页面,请在这方面帮助我
<?php
$checkfollowing =$db->prepare("SELECT * FROM follow_user WHERE uid_fk=:id");
$checkfollowing->execute(array(':id'=>$id));
$count = $checkfollowing->rowCount(); ?>
<a href='following.php' style='text-decoration:none;margin-left:40px;'><?php print $count; ?></a>
您可以通过url传递值,并使用
$\u get
方法在其他页面上获取值。
检查下面的代码
<a href='following.php?id=<?php echo $id ; ?>' style='text-decoration:none;margin-left:40px;'><?php print $count; ?></a>
通过在url末尾指定变量,可以通过url传递变量。像这样
<a href='following.php?count=<?php echo $count; ?>' style='text-decoration:none;margin-left:40px;'><?php print $count; ?></a>
<a href='following.php?id=<?php echo $id; ?>' style='text-decoration:none;margin-left:40px;'><?php print $count; ?></a>