Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Pretty urls (See related posts)

If url is 'index.php/hello' then $request will be 'hello'

$request = $_SERVER['PATH_INFO'];
if (isset($request[0]) && ($request[0] == '/')) {
    $request = substr($request, 1);
}

Comments on this post

peter posts on May 24, 2005 at 20:42
Cool! I don't know PHP, but is there a way you could use a 'split' sort of function to do this automatically?
pecesama posts on Feb 19, 2007 at 23:13
In order to do the 'split' thing:

$data = explode("/",$_SERVER['PATH_INFO']);
$request = $data[0];

You need to create an account or log in to post comments to this site.


Click here to browse all 4860 code snippets

Related Posts