Skip to content

Instantly share code, notes, and snippets.

@madzak
Last active August 29, 2015 13:56
Show Gist options
  • Save madzak/9120474 to your computer and use it in GitHub Desktop.
Save madzak/9120474 to your computer and use it in GitHub Desktop.
Router for light PHP applications
<?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