Skip to content

Instantly share code, notes, and snippets.

@shaunlee
Created August 28, 2015 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaunlee/5e3ef1dee18eb248f0e7 to your computer and use it in GitHub Desktop.
Save shaunlee/5e3ef1dee18eb248f0e7 to your computer and use it in GitHub Desktop.
Phalcon Micro MVC Router
<?php
$filename = $_SERVER['REQUEST_URI'];
if ($i = strpos($filename, '?')) {
$filename = substr($filename, 0, $i);
}
if (file_exists(__DIR__ . $filename)) {
return false;
}
if (isset($_SERVER['PATH_INFO'])) {
$_GET['_url'] = $_SERVER['PATH_INFO'];
} else {
$_GET['_url'] = $_SERVER['REQUEST_URI'];
}
include 'index.php';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment