First make one function like below
$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$param = GET;
function filter_url($url,$param){
$parsed = parse_url($url);
$query = str_replace("&","&",$parsed['query']);
parse_str($query,$params);
unset($params[$param]);
$new_query = http_build_query($params);
$newUrl = $parsed['scheme']."://".$parsed['host'].$parsed['path'];
if($new_query){
$newUrl .= "?".$new_query;
}
return $newUrl;
}
$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$param = GET;
function filter_url($url,$param){
$parsed = parse_url($url);
$query = str_replace("&","&",$parsed['query']);
parse_str($query,$params);
unset($params[$param]);
$new_query = http_build_query($params);
$newUrl = $parsed['scheme']."://".$parsed['host'].$parsed['path'];
if($new_query){
$newUrl .= "?".$new_query;
}
return $newUrl;
}
No comments:
Post a Comment