by Hiroshi on August 7th, 2008
I have other solutions to find file path at server or file name using PHP. The thing is, some php scripts might not work with some versions of PHP or in some situations. So more methods you learn for each task with PHP, the better. Here goes more solutions; Enjoy!
In this example I used CurrentpageURL.php page and tested it via wamp server at local host.
<?php echo htmlspecialchars($_SERVER['REQUEST_URI']) ?>
Display
/CurrentpageURL.php
<?php echo $_SERVER['REQUEST_URI'] ?>
Display
/CurrentpageURL.php
<?php $url = sprintf("%s%s%s","http://",$HTTP_HOST,$REQUEST_URI); echo "$url"; ?>
Display
http://localhost/CurrentpageURL.php
<?php $sPage = explode("/", $_SERVER['PHP_SELF']); $rs= $sPage[count($sPage)-1]; echo "$rs"; ?>
Display
CurrentpageURL.php



Incoming Searches