【发布时间】:2017-12-17 06:28:23
【问题描述】:
我在 slim 框架中编写了 REST api。当我从浏览器调用身份验证 API 时,它通过 'Method not allowed。必须是以下之一:POST'。以下是我的代码,请纠正我哪里出错了。
Index.php
<?php
require 'vendor/autoload.php';
require 'Authenticate.php';
$app = new \Slim\App;
$app->post('/api/authenticate', \Authenticate::class);
$app->run();
.htaccess
RewriteEngine On
RewriteRule ^ index.php [QSA,L]
网址
http://localhost/project/api/authenticate
【问题讨论】: