simun Posted July 10, 2009 Share Posted July 10, 2009 how to get name of current page of url? exsample: if my url is www.mysite.com/files/images/page.php i wish to echo onley page.php from that,,, how to do it? Quote Link to comment https://forums.phpfreaks.com/topic/165472-request-url/ Share on other sites More sharing options...
ignace Posted July 10, 2009 Share Posted July 10, 2009 <?php print basename($_SERVER['SCRIPT_NAME']); ?> Quote Link to comment https://forums.phpfreaks.com/topic/165472-request-url/#findComment-872724 Share on other sites More sharing options...
simun Posted July 10, 2009 Author Share Posted July 10, 2009 and what if i have something like this: $putanja = "../files/naslovi/" . $_GET['id'] . "/" . $photo['filename'] . ".txt"; and i need that my variable $putanja echo onley . $photo['filename'] . ".txt" i have try $putanja = substr("../files/naslovi/" . $_GET['id'] . "/" . $photo['filename'] . ".txt", -20, -4); bote some times my id have 3 characters sometimes 1 character, and thats not good solution, Quote Link to comment https://forums.phpfreaks.com/topic/165472-request-url/#findComment-872730 Share on other sites More sharing options...
niranjnn01 Posted July 10, 2009 Share Posted July 10, 2009 hello use $_SERVER['PHP_SELF'] Quote Link to comment https://forums.phpfreaks.com/topic/165472-request-url/#findComment-872741 Share on other sites More sharing options...
ignace Posted July 10, 2009 Share Posted July 10, 2009 Then it would still work $putanja = "../files/naslovi/" . $_GET['id'] . "/" . $photo['filename'] . ".txt"; print basename($putanja); //$photo['filename'].txt Quote Link to comment https://forums.phpfreaks.com/topic/165472-request-url/#findComment-872753 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.