-
-
Save brtriver/978383 to your computer and use it in GitHub Desktop.
Silex error
This file contains hidden or 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
<?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(); |
This file contains hidden or 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
$ 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