$url="http://services.php?service_cat=14;&mess_pop=Service_cart";
と
$url="http://index.php?mess_pop=Thank_you";
これらの URL から、 のない新しい URL が必要$_GET['mess_pop']
です。
$url="http://services.php?service_cat=14;&mess_pop=Service_cart";
と
$url="http://index.php?mess_pop=Thank_you";
これらの URL から、 のない新しい URL が必要$_GET['mess_pop']
です。
このようなものを試すことができます
$out = array();
parse_str($url, $out);
unset($out['mess_pop']);
$newURL = 'http://index.php?' . http_build_query($out);
すべてのパラメーターをループし$_GET
、それらを新しい配列に追加して、メッセージをスキップできます。
$new_get = array();
foreach($_GET as $key => $value)
{
if($key != 'mess_pop')
{
$new_get[$key] => $value;
}
}
新しい URL を生成するには:
$url_query = "?";
foreach($new_get as $key => $value)
{
$url_query .= urlencode($key) .'='. urlencode($value) .'&';
}
// To remove last '&'
$url_query = trim($url_query, '&');
このコードを試してください:
$parse_url=parse_url($url);
parse_str($parse_url['query'],$parse_str);
unset($parse_str['mess_pop']);
$new_url=http_build_query($parse_str);
$url = parse_url($url);
parse_str($url['query'], $qs);
unset($qs['mess_pop']);
$url['query'] = http_build_query($qs);
$url = $url['scheme'] . '://' . $url['host'] . $url['path'] . '?' . $url['query'];