Slim PHP框架帮助 [英] Slim PHP Framework Help
本文介绍了Slim PHP框架帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚在我的网站上添加了Slim框架,以创建一个Rest API.但是我目前有一个问题.我编写此代码作为测试,以检查获取请求是否有效,但是每当我尝试调用url时,
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();
推荐答案
您可能忘记将Slim
随附的.htaccess
文件放在与index.php
相同的目录中.
You have propably forgotten to put the .htaccess
file provided with Slim
in the same directory as your index.php
.
这篇关于Slim PHP框架帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文