hno Posted June 25, 2009 Share Posted June 25, 2009 HI How can get the current url of the open page? thanks Quote Link to comment https://forums.phpfreaks.com/topic/163582-how-to-get-the-current-url/ Share on other sites More sharing options...
chmpdog Posted June 25, 2009 Share Posted June 25, 2009 $_SESSION["PHP_SELF"]; Quote Link to comment https://forums.phpfreaks.com/topic/163582-how-to-get-the-current-url/#findComment-863095 Share on other sites More sharing options...
Alex Posted June 25, 2009 Share Posted June 25, 2009 $_SESSION["PHP_SELF"]; Do you mean $_SERVER['PHP_SELF']; ? Quote Link to comment https://forums.phpfreaks.com/topic/163582-how-to-get-the-current-url/#findComment-863099 Share on other sites More sharing options...
chmpdog Posted June 25, 2009 Share Posted June 25, 2009 haha... Oops Im thinking about too many things Quote Link to comment https://forums.phpfreaks.com/topic/163582-how-to-get-the-current-url/#findComment-863101 Share on other sites More sharing options...
hno Posted June 25, 2009 Author Share Posted June 25, 2009 $_SESSION["PHP_SELF"]; Do you mean $_SERVER['PHP_SELF']; ? But when i use echo $_SERVER['PHP_SELF']; it didn't return anything? Quote Link to comment https://forums.phpfreaks.com/topic/163582-how-to-get-the-current-url/#findComment-863102 Share on other sites More sharing options...
Alex Posted June 25, 2009 Share Posted June 25, 2009 $_SESSION["PHP_SELF"]; Do you mean $_SERVER['PHP_SELF']; ? But when i use echo $_SERVER['PHP_SELF']; it didn't return anything? It should, it will return the directory/file in terms of the root folder. <?php echo $_SERVER['PHP_SELF']; ?> Quote Link to comment https://forums.phpfreaks.com/topic/163582-how-to-get-the-current-url/#findComment-863104 Share on other sites More sharing options...
chmpdog Posted June 25, 2009 Share Posted June 25, 2009 but be warned it does not record anything after the ? (but there is another function that does it[i just cant remember]) Quote Link to comment https://forums.phpfreaks.com/topic/163582-how-to-get-the-current-url/#findComment-863117 Share on other sites More sharing options...
Alex Posted June 25, 2009 Share Posted June 25, 2009 Maybe you want $_SERVER['REQUEST_URI']; ? Quote Link to comment https://forums.phpfreaks.com/topic/163582-how-to-get-the-current-url/#findComment-863130 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.