hno Posted June 25, 2009 Share Posted June 25, 2009 HI How can get the current url of the open page? thanks 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"]; 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']; ? 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 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? 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']; ?> 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]) 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']; ? 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
Archived
This topic is now archived and is closed to further replies.