Jump to content

$_SERVER[' ?????????? ']


poe

Recommended Posts

if i go:

$homePage = $_SERVER['REQUEST_URI'];

 

i get:

home page = /indie/index.php?list=top

 

 

 

if i go:

$homePage = basename($_SERVER[php_SELF]);

 

i get:

home page = index.php

 

 

 

 

what i want is something in the middle:

 

home page = index.php?list=top

 

 

so it only shows the base script name, but also includes the parameters.

 

thanks

chris

Link to comment
https://forums.phpfreaks.com/topic/51211-_server/
Share on other sites

<?php

function typedurl() {
$homePage = basename($_SERVER["PHP_SELF"]);
$homePage .= "?";
foreach($_GET as $k => $v) {
$homePage .= "$k=$v&";
}
$length = strlen($homePage);
$newlen = $length - 1;
$homePage = substr($homePage, 0, $newlen);
return $homePage;
}

echo typedurl();

?>

Link to comment
https://forums.phpfreaks.com/topic/51211-_server/#findComment-252168
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.