// 登陆
try {
validate(\app\common\validate\User::class)
->scene('login')
->check($this->request->post(['username', 'password']));
} catch (\Exception $e) {
return redirect('login')->with('error', $e->getMessage())->with($this->request->post());
}路由做token验证 Route::any('/user/login', 'user/login')->token();表单里添加token字段:{:token_field()}上述操作,因为redirect带了with,造成重定向之后,session里的token为空,二次提交token无效。 最佳答案