ImD*_*til 3 php .htaccess slim
我已经在纤薄的框架中编写了 REST api。当我从浏览器调用身份验证 API 时,它通过“不允许的方法”。必须是以下之一: POST'。下面是我的代码,请纠正我哪里出错了。
索引.php
<?php
require 'vendor/autoload.php';
require 'Authenticate.php';
$app = new \Slim\App;
$app->post('/api/authenticate', \Authenticate::class);
$app->run();
Run Code Online (Sandbox Code Playgroud)
.htaccess
RewriteEngine On
RewriteRule ^ index.php [QSA,L]
Run Code Online (Sandbox Code Playgroud)
网址
http://localhost/project/api/authenticate
Run Code Online (Sandbox Code Playgroud)