douju8113 2016-01-28 20:36
浏览 116

从php中的querystring中删除参数及其值

i have the following redirect script.

i have a redirect script that uses a querystring param to know where do redirect to. would like to strip out the param and its value and rebuid the query-string before it redirects. so the referrer does not contain the param value.

this is my currently code.

  $check   = $_GET['param'];    
    function redirect($location) {
          header("Location: $location");
        exit;}

        if($_GET['param'] === '1'){
        redirect('http://domain.com/');
        }
  • 写回答

2条回答 默认 最新

  • douzhao2047 2016-01-28 20:43
    关注

    Just unset it and then build it:

    unset($_GET['param']);
    $querystring = http_build_query($_GET);
    
    评论

报告相同问题?