Skip to content

Instantly share code, notes, and snippets.

@brtriver
Forked from heavenshell/gist:978358
Created May 18, 2011 11:12
Show Gist options
  • Save brtriver/978383 to your computer and use it in GitHub Desktop.
Save brtriver/978383 to your computer and use it in GitHub Desktop.
Silex error
<?php
require_once 'silex.phar';
$app = new Silex\Application();
$app->get('/', function () {
return 'index';
});
$app->get('/hello/{name}', function ($name) {
return "Hello $name";
})
->assert('name', '^.*')
->convert('name', function ($name, $request) {
return $request->get('name') ?: "bar";
});
$app->get('/hello2/{name}', function ($name) {
$name = !empty($name)? $name: "bar";
return "Hello $name";
})
->assert('name', '^.*') ;
$app->run();
$ curl http://localhost/silex.php/hello/
Fatal error: Uncaught exception 'Symfony\Component\Routing\Matcher\Exception\NotFoundException' in phar:///tmp/silex.phar/src/Silex/Application.php on line 167
Symfony\Component\Routing\Matcher\Exception\NotFoundException: in phar:///tmp/silex.phar/vendor/Symfony/Component/Routing/Matcher/UrlMatcher.php on line 33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment