今天有位老铁需要php获取后面参数进行判断参数跳转目标站,例如:比如1.php?id=1 跳转baidu.com id=2 跳转到qq.com,怎么做到,查看以下代码:
<?php //通过get函数获取id $id=$_GET['id']; if($id=="1"){ $url="http://www.baidu.com"; header('HTTP/1.1 301 Moved Permanently'); Header("Location:$url"); }else if($id=="2"){ $url="http://www.qq.com"; header('HTTP/1.1 301 Moved Permanently'); Header("Location:$url"); }else{ $url="http://www.kaotop.com"; header('HTTP/1.1 301 Moved Permanently'); Header("Location:$url"); } ?>
文章来自:php获取后面参数进行判断参数跳转目标站 - 考高分网 (kaotop.com)