Guest User

Untitled

a guest
Jan 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4. * make sure you have the $routes array
  5. * and bind function in proper scope.
  6. */
  7.  
  8. // this where we get whatever we are rewriting
  9. $path = $_GET['q'];
  10.  
  11. foreach ($routes as $pattern => $bind) {
  12. // if we match more than 0, it was succesfull
  13. if (preg_match($pattern, $path, $params) > 0) {
  14. $bind(array_slice($params, 1));
  15. break;
  16. }
  17. }
  18.  
  19. ?>
Add Comment
Please, Sign In to add comment