dpnv33177 2019-02-14 19:22
浏览 601
已采纳

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException没有消息抛出新的MethodNotAllowedHttpException($ others);

Ok so trying to submit a form in Laravel, but keep getting this issu

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException No message

I check all my code to see what could be the problem, I even tried the command php artisan route:list and signup route shows up

welcome.blade.php
  <form action="{{ URL('signup') }}" method="post">
       <div class="form-group">
         <label for="email">You'r E-Mail</label>
           <input class="form-control" type="text" name="email" 
             id="email">
            </div>
            <div class="form-group">
            <label for="first_name">You'r First Name</label>
            <input class="form-control" type="text" 
             name="first_name" id="first_name">
            </div>
            <div class="form-group">
            <label for="password">You'r Password</label>
            <input class="form-control" type="password" 
              name="password" id="password">
            </div>
            <button type="submit" class="btn btn- 
              primary">Submit</button>
          <input type="hidden" name="_token" value=" 
            {{Session::token() }}">
        </form>

routes/web.php

 Route::group(['middleware' => ['web']],function(){

     Route::get('/',function() {
      return view('welcome');
     });

     Route::post('/signup',[
         'uses'=>'UserController@postSignUp',
         'as'=>'signup'
      ]);
     });

Controllers/UserController.php

  <?php
  namespace App\Http\Controllers;
   use Illuminate\Http\Request;

  class UserController extends Controller 
  {
      public function postSignUp(Request $request)
      {
         $email = $request['email'];
         $first_name = $request['first_name'];
         $password = bcrypt($request['password']);
         $user = new User();
         $user->email = $email;
         $user->first_name = $first_name;
         $user->password = $password;
         $user->save();
      }
  public function postSignIn(Request $request)
  {

  }
}

After pressing submit button it should add to my xampp database I have running locally

  • 写回答

1条回答 默认 最新

  • doudou5421 2019-02-21 03:49
    关注

    MethodNotAllowedHttpException was do to the way I setup my server in XAMAPP and my routes. Solves it by How to resolve the error: SQL authentication method unknown in Laravel-MySql

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题