duansengcha9114 2017-02-07 04:22
浏览 89
已采纳

苗条骨架框架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-19 07:00
    关注

    Have you tried something like:

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

报告相同问题?

悬赏问题

  • ¥15 深度学习残差模块模型
  • ¥20 两个不同Subnet的点对点连接
  • ¥50 怎么判断同步时序逻辑电路和异步时序逻辑电路
  • ¥15 差动电流二次谐波的含量Matlab计算
  • ¥15 Can/caned 总线错误问题,错误显示控制器要发1,结果总线检测到0
  • ¥15 C#如何调用串口数据
  • ¥15 MATLAB与单片机串口通信
  • ¥15 L76k模块的GPS的使用
  • ¥15 请帮我看一看数电项目如何设计
  • ¥23 (标签-bug|关键词-密码错误加密)