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. 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 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']; 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
Archived
This topic is now archived and is closed to further replies.