Search
 
SCRIPT & CODE EXAMPLE
 

PHP

remove get parameters from url php

function strip_param_from_url( $url, $param ) {
    $base_url = strtok($url, '?');              // Get the base url
    $parsed_url = parse_url($url);              // Parse it 
    $query = $parsed_url['query'];              // Get the query string
    parse_str( $query, $parameters );           // Convert Parameters into array
    unset( $parameters[$param] );               // Delete the one you want
    $new_query = http_build_query($parameters); // Rebuilt query string
    return $base_url.'?'.$new_query;            // Finally url is ready
}
// Usage
echo strip_param_from_url( 'http://url.com/search/?location=london&page_number=1', 
	'location' )
Comment

php remove all parameter from url

 $url = strtok($url, '?');
Comment

PREVIOUS NEXT
Code Example
Php :: loop through months and year php 
Php :: laravel with trashed specific 
Php :: register acf options page 
Php :: is_array php 
Php :: php remove slashes from json 
Php :: string length php 
Php :: yii2 get cookie 
Php :: stream_set_blocking 
Php :: foreach skip first php 
Php :: how to run a specific test in laravel 
Php :: add csrf token laravel 
Php :: wpml display language switcher 
Php :: how import the impliment countable php 
Php :: array to table php 
Php :: php save image from url to folder 
Php :: php salto de linea 
Php :: laravel login by id 
Php :: create date from string php 
Php :: php pdo connection 
Php :: php base64 to image 
Php :: required field in laravel admin 
Php :: get cart item by cart item key woocommerce 
Php :: laravel module remove 
Php :: php pdo Check if row exists in the database 
Php :: php get query params 
Php :: filemtime($current_file_name); 
Php :: how to check exist in array in rule validation laravel 
Php :: array push foreach php 
Php :: wordpress get link to post by id 
Php :: How do I get PHP errors to display 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =