Created
August 18, 2014 12:32
-
-
Save steveathon/c48b1b4eea5d8c5aa093 to your computer and use it in GitHub Desktop.
Explode PHP $_SERVER['REQUEST_URI'];
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$URIParts = explode('?',$_SERVER['REQUEST_URI']); | |
$URI = explode('/',$URIParts[0]); | |
// Shift the array, to move it past the 'root' | |
@array_shift($URI); | |
// Now, get rid of any pesky empty end slashes | |
while ( @count($URI) > 0 && !end($URI) ) { | |
@array_pop($URI); | |
} | |
print_r($URI); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment