Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 5th, 2012  |  syntax: None  |  size: 0.49 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Multiple routes with the same anonymous callback using Slim Framework
  2. $app->get('/first_route',function()
  3. {
  4.    //Do stuff
  5. });
  6. $app->get('/second_route',function()
  7. {
  8.    //Do same stuff
  9. });
  10.        
  11. $app->get(['/first_route','/second_route'],function()
  12. {
  13.        //Do same stuff for both routes
  14. });
  15.        
  16. $app->get('/first_route',function() use($app)
  17. {
  18.    $app->get('/second_route');//Without redirect
  19. });
  20.        
  21. $app->get('/first_route', $ref = function()
  22. {
  23.    //Do stuff
  24. });
  25. $app->get('/second_route', $ref);