Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * make sure you have the $routes array
- * and bind function in proper scope.
- */
- // this where we get whatever we are rewriting
- $path = $_GET['q'];
- foreach ($routes as $pattern => $bind) {
- // if we match more than 0, it was succesfull
- if (preg_match($pattern, $path, $params) > 0) {
- $bind(array_slice($params, 1));
- break;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment