Last active
August 29, 2015 13:56
-
-
Save madzak/9120474 to your computer and use it in GitHub Desktop.
Router for light PHP applications
This file contains hidden or 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 | |
// router.php | |
if (0 === strpos($_SERVER['REQUEST_URI'], '/bower_components/')) { | |
$this_page = $_SERVER['REQUEST_URI']; | |
if (strpos($this_page, "?") !== false) { | |
$exploded = explode("?", $this_page); | |
$this_page = reset($exploded); | |
} | |
readfile('..' . $this_page); | |
return true; | |
} | |
return false; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment