I have come to the conclusion that my server is set up so that REQUEST_URI does not work properly.
I have used PHP_SELF a handfull of times.
Can anyone tell me the difference between the two, and if one is better than the other.
Thanks
I have come to the conclusion that my server is set up so that REQUEST_URI does not work properly.
I have used PHP_SELF a handfull of times.
Can anyone tell me the difference between the two, and if one is better than the other.
Thanks
Basically, the difference is that REQUEST_URI will display any query string attached to the url, while PHP_SELF will not.
Lets say we got a url like http://www.domain.com/phptests/self.php?id=1.
// will display /phptests/self.php
echo $_SERVER['PHP_SELF'];
// will display /phptests/self.php?id=1
echo $_SERVER['REQUEST_URI'];
Oh I see…that makes sense. would the way a server is set up effect being able to use REQUEST_URI?
hello,
when you wanna have only the script name you can use
either $_SERVER variables…
gives the same result.
$file = basename($_SERVER['REQUEST_URI']);
$file = basename($_SERVER['PHP_SELF']);
also interessting function are:
[b][color=black]dirname()[/color][/b][color=black] und [/color][url=“http://mk:@msitstore:C:Dokumente%20und%20EinstellungensboelsteDesktopHomepagea_Helpfiles%20Tutorial%20CHM’sphp_manual_de.chm::/de/function.pathinfo.html”][b][color=black]pathinfo()[/color][/b].
greez Pozor