duansengcha9114 2017-02-06 20:22
浏览 90
已采纳

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

I tried almost everything but I keep receiving

Method not allowed

Method not allowed. Must be one of: POST

The code that I'm using is:

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

I'm trying on postman

method: post
url: /public/ticket/new
header: Content-Type application/javascript

Any clue will help me

.htaccess is ok:

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]

Thanks a lot

  • 写回答

1条回答 默认 最新

  • du13932014807 2017-02-18 23:00
    关注

    Have you tried something like:

    $app->map(['GET', 'POST'],'/ticket/new', function (Request $request, Response     $response) {
        // Create new book
        echo 'a;';
    });
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部