Slim PHP Framework Help
-
25-10-2019 - |
Pergunta
I just added the Slim framework to my website in order to create a rest API. But I currently have a problem. I wrote this code as a test to check to see if a get request would work, but whenever I try calling the url, http://mysite.com/api/rest/hello/max, I get a website not found error. Please can you tell me what is going wrong?
Slim::init();
Slim::get('/hello/:name', 'hello');
function hello($name) {
echo "Hello, $name!";
}
Slim::run();
Solução
You have propably forgotten to put the .htaccess
file provided with Slim
in the same directory as your index.php
.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow