protected function removeQsVar($url, $varName) {
        $parts = parse_url($url);
        $queryParams = array();
        parse_str(html_entity_decode($parts['query']), $queryParams);
        unset($queryParams[$varName]);
        $queryString = http_build_query($queryParams);
        if(strlen($queryString)>0){
            $queryString = '?' . $queryString;
        }
        $url = $parts['scheme'] . '://' . $parts['host'] . $parts['path'] . $queryString;
        return $url;
    }

Leave a reply

Your email address will not be published.