public function request1(Request $request){ //取值 $name = Request::input('name'); //是否有值 if($request->has('name')){ echo $request->input('name'); } $res = $request->all(); //判断请求类型 echo $request->method(); if($request->isMethod('POST')){ echo 'yes'; } //判断是否是ajax $res = $request->ajax(); //判断是否是某控制器下的方法 $bool = $request->is('student/*'); //获取当前的url echo $request->url();}
Laravel 控制器的request
点赞
收藏