
php如何传递url后面的所有参数?
比如url是这样的:www.domain.com/index.php?id=123&keyword=xxxindex.php代码是这样的:<?php$id=$_GET['...
比如url是这样的:www.domain.com/index.php?id=123&keyword=xxx
index.php代码是这样的:
<?php
$id=$_GET['id'];
if($id=='123'){
header("location:http://www.domain.com/123/");
exit();
}
if($id=='456'){
header("location:http://www.domain.com/456/");
exit();
}
?>
判断id的值跳转到不同的页面,keyword=xxx这个是自动生成的,值是随机的。
我现在就是想点击这个链接
www.domain.com/index.php?id=123&keyword=xxx
判断id=123,跳转到
http://www.domain.com/123/的时候,要把参数传过来,最终的效果:
http://www.domain.com/123/?id=123&keyword=xxx 展开
index.php代码是这样的:
<?php
$id=$_GET['id'];
if($id=='123'){
header("location:http://www.domain.com/123/");
exit();
}
if($id=='456'){
header("location:http://www.domain.com/456/");
exit();
}
?>
判断id的值跳转到不同的页面,keyword=xxx这个是自动生成的,值是随机的。
我现在就是想点击这个链接
www.domain.com/index.php?id=123&keyword=xxx
判断id=123,跳转到
http://www.domain.com/123/的时候,要把参数传过来,最终的效果:
http://www.domain.com/123/?id=123&keyword=xxx 展开
1个回答
展开全部
这样修改吧
header("location:http://www.domain.com/456/?id=$id&key=$key");
header("location:http://www.domain.com/456/?id=$id&key=$key");
望采纳
header("location:http://www.domain.com/456/?id=$id&key=$key");
header("location:http://www.domain.com/456/?id=$id&key=$key");
望采纳
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |