Route.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. * URL Routing
  4. *
  5. * URLs are very important to the future usability of your site. Take
  6. * time to think about your structure in a way that is meaningful. Place
  7. * your most common page routes at the top for better performace.
  8. *
  9. * - Routes are matched from left-to-right.
  10. * - Regex can also be used to define routes if enclosed in "/.../"
  11. * - Each regex catch pattern (...) will be viewed as a parameter.
  12. * - The remaning (unmached) URL path will be passed as parameters.
  13. *
  14. ** Simple Example **
  15. * URL Path: /forum/topic/view/45/Hello-World
  16. * Route: "forum/topic/view" => 'Forum\Controller\Forum\View'
  17. * Result: Forum\Controller\Forum\View->action('45', 'Hello-World');
  18. *
  19. ** Regex Example **
  20. * URL Path: /John_Doe4/recent/comments/3
  21. * Route: "/^(\w+)/recent/comments/' => 'Comments\Controller\Recent'
  22. * Result: Comments\Controller\Recent->action($username = 'John_Doe4', $page = 3)
  23. */
  24. $config = array();
  25. $config['routes'] = array(
  26. '' => '\Controller\Index',
  27. '404' => '\Controller\Page404',
  28. 'school' => '\Controller\School',
  29. 'json' => '\Controller\Benchmark\Json',
  30. 'db' => '\Controller\Benchmark\Db',
  31. // Example paths
  32. //'example/path' => '\Controller\Example\Hander',
  33. //'example/([^/]+)' => '\Controller\Example\Param',
  34. );