Laravel 5 / Lumen Request Header?

前端 未结 5 620
你的背包
你的背包 2021-02-05 04:32

So I am not really sure how to go about this I have tried a few things and I will list one below however what I am trying to do is store information sent in a http request in a

5条回答
  •  不知归路
    2021-02-05 04:57

    Actually you are calling it statically, that's why it is not getting appropriate Request class and throwing error, can do as follows

    use Illuminate\Http\Request;
    
    //inside your controller
    class YourClass extends Controller{
       public function yourFunction(Request $request){
            //for getting all the request
            dd($request->all());
    
            //for getting header content
            dd($request->header('pubapi'));
       }
    }
    

提交回复
热议问题