Created
November 20, 2012 01:08
-
-
Save glsee/4115284 to your computer and use it in GitHub Desktop.
Sample Silex app that has routing problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// myapp/app/app.php | |
// ... | |
// route definitions | |
$app->mount('/myapp/subscribers', include 'controller/subscriber.php'); | |
// later I tried these: | |
// this works | |
$app->get('/myapp/test/', function() { | |
// do something | |
}); | |
// these do not work | |
$app->get('/myapp/{var}/', function($var){ | |
// do something | |
}); | |
$app->get('/myapp/test/{var}/', function($var){ | |
// do something | |
}); | |
// ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// myapp/app/controller/subscriber.php | |
// ... | |
$subs = $app['controllers_factory']; | |
// this works | |
$subs->post('/', function (Application $app, Request $request) { | |
// do something | |
}); | |
// this does not work | |
$subs->match('/{mobile}/', function (Application $app, Request $request, $mobile) { | |
$mobile = $app->escape($mobile); | |
// do something | |
})->method('GET|PUT|DELETE'); | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment