PHP 5.6.12
Slim 3.1.0
Running the command:
php -S localhost:8000 test.php
With this code:
// test.php
require 'vendor/autoload.php';
$app = new \Slim\App;
$app->get('/{name}', function ($request, $response) {
$name = $request->getAttribute('name');
$response->getBody()->write("Hello, $name");
return $response;
});
$app->run();
When I try GET “localhost:8000/foo” returns “Page not found”
But when i try: “localhost:8000/foo%20bar_after_space” returns correctly: “Hello, foo bar_after_space”.
Anyone know how to solve this?
Thanks
SOLUTION:
If i rename the file to “index.php”, run the code below and works…
php -S localhost:8000 -t .