slim 骨架框架 Post 方法给出 "Method not allowed"
slim skeleton framework Post Method gives "Method not allowed"
我几乎什么都试过了
但我一直收到
不允许的方法
方法不允许。必须是以下之一:
POST
我使用的代码是:
$app->post('/ticket/new', function (Request $request, Response $response) {
// Create new book
echo 'a;';
});
我正在试用 postman
method: post
url: /public/ticket/new
header: Content-Type application/javascript
任何线索都会对我有所帮助
.htaccess
可以:
RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
非常感谢
你有没有尝试过类似的东西:
$app->map(['GET', 'POST'],'/ticket/new', function (Request $request, Response $response) {
// Create new book
echo 'a;';
});
我几乎什么都试过了 但我一直收到
不允许的方法
方法不允许。必须是以下之一: POST
我使用的代码是:
$app->post('/ticket/new', function (Request $request, Response $response) {
// Create new book
echo 'a;';
});
我正在试用 postman
method: post
url: /public/ticket/new
header: Content-Type application/javascript
任何线索都会对我有所帮助
.htaccess
可以:
RewriteEngine On
# Some hosts may require you to use the `RewriteBase` directive.
# If you need to use the `RewriteBase` directive, it should be the
# absolute physical path to the directory that contains this htaccess file.
#
# RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
非常感谢
你有没有尝试过类似的东西:
$app->map(['GET', 'POST'],'/ticket/new', function (Request $request, Response $response) {
// Create new book
echo 'a;';
});