我现在一直在使用slim,今天我更新到3.8并开箱即用我注意到了
$app->get('/', function ($request, $response) {
return 'Slim working';
});
$app->get('/hello', function ($request, $response) {
return 'Slim hello also working';
});
第一个方法调用有效,第二个方法给我Object not found!
错误,我不明白有什么问题,有人可以帮我理解。
所以我的文件夹结构就像appname/public/index.php
我只需要调用appname/public/
来运行第一个方法,就像appname/public/hello
答案 0 :(得分:1)
您需要在根目录(最可能是appname / public)中添加.htaccess文件,并附带以下规则
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
希望它会起作用。