Slim PHP Framework Help

2019-04-14 09:20发布

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();

1条回答
混吃等死
2楼-- · 2019-04-14 10:01

You have propably forgotten to put the .htaccess file provided with Slim in the same directory as your index.php.

查看更多
登录 后发表回答