public function resins(Request $request) { //表单上传的话 必须除去_token $input = $request->except('_token'); $res = Stu::create($input); if ($res){ return 'success'; } else { return 'fail'; } }
或者:
public function resins() { //这样的话会默认创建的时候屏蔽_token // 需要 use Request; $input = Request::all(); $res = Stu::create($input); if ($res){ return 'success'; } else { return 'fail'; } }
下次有时间再来注释
session()->has('user')) { return view('welcome'); } $stu = Stu::findorfail($id); return view('log',compact('stu')); } public function inlog(Request $request) { $input = $request->all(); $res = Stu::where(['english'=>$input['english'],'math'=>$input['math']])->get(); if ($res->count()){ $request->session()->put('user',$input['math']); return 'YES'; } else { return 'NO'; } }}