Created
April 16, 2020 10:25
-
-
Save blogcacanid/4c61c52d8fdc1560762500df6a64baa3 to your computer and use it in GitHub Desktop.
get_uri Covid-19 AngularJS
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 | |
// Get URI Segments | |
$uriSegments = explode("/", parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); | |
// Usage: | |
// URL = http://www.example.com/codex/foo/bar. | |
//echo $uriSegments[1]; //returns codex | |
//echo $uriSegments[2]; //returns foo | |
//echo $uriSegments[3]; //returns bar | |
// Get Last URL Segment | |
$lastUriSegment = array_pop($uriSegments); | |
// Usage: | |
// URL = http://www.example.com/codex/foo/bar. | |
//$lastUriSegment = array_pop($uriSegments); | |
//echo $lastUriSegment; //returns bar | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment