苗条骨架框架Post Method给出“方法不允许”

时间:2017-02-07 04:22:17

标签: php .htaccess rest slim

我几乎尝试了一切 但我一直在接受         

不允许使用方法

        

不允许使用方法。必须是以下之一:             的 POST

我正在使用的代码是:

$app->post('/ticket/new', function (Request $request, Response $response) {
    // Create new book
    echo 'a;';
});

我正在尝试邮递员

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]

非常感谢

1 个答案:

答案 0 :(得分:0)

你有没有试过像:

$app->map(['GET', 'POST'],'/ticket/new', function (Request $request, Response     $response) {
    // Create new book
    echo 'a;';
});