标签:
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‘; } }
下次有时间再来注释
<?php namespace App\Http\Controllers; use App\Stu; use Illuminate\Support\Facades\Input; use Illuminate\Http\Request; //use Request; use App\Http\Requests; class LogController extends Controller { // public function log(Request $request, $id) { if ($request->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‘; } } }
标签:
原文地址:http://www.cnblogs.com/xj76149095/p/5631535.html