chaseman Posted February 27, 2011 Share Posted February 27, 2011 What is an equivalent super global to $_SERVER['PHP_SELF'] that gives me JUST the currently opened document name without the path? e.g. profile.php but NOT: directory1/directory2/profile.php What I mean by that is, if I echo out $_SERVER['PHP_SELF'], it will give me the directories as well, but I'm just interested in the document name. I've looked for the $_SERVER super global in the PHP manual, but no results come up. Quote Link to comment https://forums.phpfreaks.com/topic/228974-get-current-file-document-name-but-not-path/ Share on other sites More sharing options...
.josh Posted February 27, 2011 Share Posted February 27, 2011 use it with basename or pathinfo Quote Link to comment https://forums.phpfreaks.com/topic/228974-get-current-file-document-name-but-not-path/#findComment-1180185 Share on other sites More sharing options...
chaseman Posted February 27, 2011 Author Share Posted February 27, 2011 Thank you a lot, worked great. $url = $_SERVER['PHP_SELF']; $path = pathinfo($url); $filename = $path['filename'] . "." . $path['extension']; Quote Link to comment https://forums.phpfreaks.com/topic/228974-get-current-file-document-name-but-not-path/#findComment-1180197 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.