Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Passing variables in PHP


jatar_k - 3:08 am on Jan 18, 2004 (gmt 0)


You have to remember that REQUEST_URI gives

The URI which was given in order to access this page; for instance, '/index.html'.

which means the data you get will be somewhat unreliable. I would use SCRIPT_NAME

Contains the current script's path. This is useful for pages which need to point to themselves.

or PHP_SELF

The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar.

it really depends on what you want to do with it.

you could use split [ca.php.net] to chop the paths up on the /, which returns an array of the parts and then grab the last part.

To return the last piece you could count [ca.php.net] the elements in the array and use that -1 and then reference the last element.


Thread source:: http://www.webmasterworld.com/php/2586.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com