为什么我明明用的 post,结果提示 get 不可用???

blade模版

<div class="form-group" id="vaptchaContainer">
                    <form action="{{ route('verifiCode') }}" class="form-group" method="POST" accept-charset="utf-8">
                        @csrf
                        <input type="hidden" name="verification_key" value="{{ $verification_key }}">
                        <input class="form-control form-control-lg text-center" id="verificode" name="verificode" placeholder="#" maxlength="4" type="tel" min="4" autocomplete="off" value="">
                        <button type="submit" class="btn btn-lg btn-primary text-dark mt-3 with-out-phone" disabled="disabled">请输入验证码</button>
                    </form>
                </div>

controller

public function verifiCode(UserRequest $request) {
        rentrun('123');
    }

request

<?php

namespace App\Http\Requests;

class UserRequest extends FormRequest
{
    public function authorize()
    {
        return true;
    }

    public function rules()
    {
        return [
            'verification_key' => 'required|string',
            'verification_code' => 'required|string',
        ];
    }

    public function attributes()
    {
        return [
            'verification_key' => '短信验证码 key',
            'verification_code' => '短信验证码',
        ];
    }

    public function messages()
    {
        return [
            'verification_key.required' => 'key不能为空',
            'verification_code.required' => '验证码不能为空'
        ];
    }
}

route

.
.
.
Route::post('/verifiCode', 'VerificationCodesController@verifiCode')->name('verifiCode');
.
.
.

错误提示

Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException
The GET method is not supported for this route. Supported methods: POST.
《L05 电商实战》
从零开发一个电商项目,功能包括电商后台、商品 & SKU 管理、购物车、订单管理、支付宝支付、微信支付、订单退款流程、优惠券等
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
讨论数量: 3

post路由get怎么用? 你要2个都能用 得用 any

4年前 评论
onetobig

看下请求的url,有没有可能是请求的 url 是 http 开头的,服务器配置了http 强制跳转 https 导致请求变成 get

4年前 评论
wongvio (楼主) 4年前
ZSCyang 2年前
lhk001 2年前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!