![](/img/trans.png)
[英]Slim Framework: Method not allowed Method not allowed. Must be one of: POST
[英]Slim Framework Method not allowed. Must be one of: POST (405)
我在slim框架中编写了REST api。 当我从浏览器调用authenticate 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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.