好的,因此尝试在Laravel中提交表单,但请继续获取此问题
Symfony \组件\ HttpKernel \ Exception \ MethodNotAllowedHttpException 没有消息
我检查了所有代码以查看可能是什么问题,我什至尝试了 命令php artisan route:list和signup route出现
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)
{
}
}
按下提交按钮后,它应该添加到我在本地运行的xampp数据库中
答案 0 :(得分:0)
MethodNotAllowedHttpException与我在XAMAPP和路由中设置服务器的方式有关。由How to resolve the error: SQL authentication method unknown in Laravel-MySql
解决