主要記錄一下,直接上程式碼!
public function index(Request $request)
{
if ($request->isMethod('post')){
$validator = Validator::make($request->all(), [
'username'=>'required|min:4|max:16',
'password'=>'required!min:6|max:20',
//..........
]);
if($validator->fails()){
return response()->json(['code'=>'201','msg'=>$validator->errors()->first()]);
}
}else{
return view('home.login.reg');
}
}
本作品採用《CC 協議》,轉載必須註明作者和本文連結