php remove all parameter from url

Solutions on MaxInterview for php remove all parameter from url by the best coders in the world

showing results for - "php remove all parameter from url"
Caterina
03 Jun 2016
1function strip_param_from_url( $url, $param ) {
2    $base_url = strtok($url, '?');              // Get the base url
3    $parsed_url = parse_url($url);              // Parse it 
4    $query = $parsed_url['query'];              // Get the query string
5    parse_str( $query, $parameters );           // Convert Parameters into array
6    unset( $parameters[$param] );               // Delete the one you want
7    $new_query = http_build_query($parameters); // Rebuilt query string
8    return $base_url.'?'.$new_query;            // Finally url is ready
9}
10// Usage
11echo strip_param_from_url( 'http://url.com/search/?location=london&page_number=1', 
12	'location' )
Lucia
29 Nov 2016
1 $url = strtok($url, '?');
2
queries leading to this page
php how to remove a specific 24 get variable from urldelete get params phpremove parameter from url phpphp remove all parameter from urlphp remove query parameter from urlhow to hide php in urlremove a specific parameter from url phpphp remove query string from urlhide url parameters phphow to remove query 3f and 3d in url phpremove query string from url phpphp remove query string variable from urlphp remove one parameter from query urlhow to hide query params from url in phpremove parameter from url variable phphow to pass hidden value in url in phpphp remove after parameter from urlphp remove and item from request urihow to hide info from url for get in phpphp remove url parameters form stringremove url parameter after get phphow to remove query params from url in phphow to remove a parameter from a url phpclear url parameters phpphp remove a parameter from url query stringremove get from url phphow to get params from url in php and remove 2520remove all get parameters from url phpphp remove all get variables form urlremove query from url phpphp hide url parametersremove all after 3f in url phpremove url before this parameter phpphp remove get parameter from urlphp url remove parameterremove url after this parameter phpphp delete parameter from url when not usedremove variable from url phpremove params from url phpremove get parameters from url phpphp remove url parameters from url stringphp remove query param from urlurl param particular parameter remove using phpphp remove parameters from urlphp remove parameter to current urlhow to remove url parameters in phphow to remove all get parameters from url phpremove all parameters from url phpphp unset url parameterphp clear url parameters after getdelete parameters from url phpphp remove url parametershow to hide url parameters in phphow to hide get parameters in url phpphp remove parameter from url onloadphp remove parameter from urlremove all parameter from url phpphp remove all parameter from url