xProteuSx Posted November 10, 2011 Share Posted November 10, 2011 I am trying to create a script that alters the navigation div depending on the page the user is on. How do I get the current page using PHP? Quote Link to comment https://forums.phpfreaks.com/topic/250893-get-current-pagelocation/ Share on other sites More sharing options...
xProteuSx Posted November 10, 2011 Author Share Posted November 10, 2011 Got it: function curPageName() {return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);} Quote Link to comment https://forums.phpfreaks.com/topic/250893-get-current-pagelocation/#findComment-1287187 Share on other sites More sharing options...
AbraCadaver Posted November 10, 2011 Share Posted November 10, 2011 You can use one of the $_SERVER vars. Try: $_SERVER['REQUEST_URI']; Quote Link to comment https://forums.phpfreaks.com/topic/250893-get-current-pagelocation/#findComment-1287188 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.